<template>
    <MenuPage
        :data="sceneList" 
        :columns="sceneCol" 
        :page.sync="querySceneInfo.pageIndex" 
        :size.sync="querySceneInfo.pageSize"
        :total="totalCount" 
        :loading="loadingTable" 
        @queryFun="getSceneList">
        <template slot="search">
            <Button type="primary" ghost @click="showMonthlyAnalysis" v-if="[1,2,4].includes(extension) && showAsset">统计信息</Button>
            <Button type="primary" ghost @click="showAddAndUpdate('')" icon="md-add" v-if="type != 18"
                >创建{{ title }}</Button
            >
            <!-- {{typeFilter(type)}} -->
            <Divider type="vertical" v-if="type != 18" />
            <Checkbox v-model="createByMe" @on-change="changePage(1)" v-if="type != 18">我创建的</Checkbox>
            <Select filterable
                clearable
                :placeholder="`${getStitle()}进度`"
                v-model="querySceneInfo.progress"
                filterable
                style="width: 150px; margin-left: 15px"
                @on-change="changePage(1)"
            >
                <Option :value="0">准备中</Option>
                <Option :value="2">进行中</Option>
                <Option :value="5" v-if="type !== 17">暂停</Option>
                <Option :value="4">已结束</Option>
                <Option :value="6">删除中</Option>
                <Option :value="7">删除失败</Option>
            </Select>
            <Select filterable
                v-model="querySceneInfo.testType"
                filterable
                placeholder="请选择测试类型"
                @on-change="changePage(1)"
                v-if="type === 17"
            >
                <Option :value="1">测试开发</Option>
                <Option :value="2">产品测试</Option>
                <Option :value="3">回归测试</Option>
                <Option :value="4">比较测试</Option>
            </Select>
            <Input
                v-model.trim="querySceneInfo.name"
                clearable
                placeholder="名称"
                style="width: 180px; margin-left: 15px"
                @on-change="changePageDebounce(1)"
            />
            <Button
                class="header-btn"
                type="primary"
                ghost
                style="height: 32px; margin-left: 5px"
                @click="refreshSceneList()"
            >
                <Icon size="16" type="ios-refresh" />
            </Button>
        </template>
        <Modal v-model="reconstruction" :title="reconstructionTitle">
            {{ reconstructionText }}
            <div slot="footer">
                <Button type="default" @click="reconstruction = false">取消</Button>
                <Button type="primary" @click="reconstructionOk">确定</Button>
            </div>
        </Modal>
        <Modal
            v-model="sceneModal.show"
            :title="sceneModal.title"
            :loading="sceneModal.loading"
            :mask-closable="false"
            @on-visible-change="createVisibleChange"
            @on-ok="saveScene('formValidate')"
            @on-cancel="handleReset('formValidate')"
            :width="sceneModal.width"
        >
            <!-- 对抗、渗透、应急和综合可以使用模板创建 -->
            <Tabs
                v-model="sceneModal.tabName"
                @on-click="changeTab"
                v-if="[0, 4, 7, 10].includes(type) && sceneModal.type == '1'"
            >
                <TabPane label="自定义" name="custom"></TabPane>
                <TabPane label="模板创建" name="template"></TabPane>
            </Tabs>
            <Form
                ref="formValidate"
                :model="formValidate"
                :rules="ruleValidate"
                :label-width="[2,8].includes(type) || (type === 5 && (extension === 0 || extension == 3)) ? 120 : (type === 5 && extension === 1) ? 130 : 96"
            >
                <!--<FormItem label="创建类型" prop="createType" v-if="[1, 2, 4, 5, 8].includes(type)&&sceneModal.type==1">
                  <Select filterable v-model="formValidate.createType" placeholder="选择创建类型">
                    <Option value="1">快速构建</Option>
                    <Option value="2">绑定工程</Option>
                  </Select>
                </FormItem>-->
                <div class="form-gourp">
                    <span class="form-title">基础信息</span>
                    <!-- 自定义 -->
                    <div v-if="sceneModal.tabName === 'custom'">
                        <FormItem
                            :label="type === 17 ? '环境工程' : '工程'"
                            prop="projectId"
                            v-if="![1, 2, 4, 5, 8, 9].includes(type)"
                        >
                            <Select filterable
                                v-if="type === 17 || !(formValidate.deployStatus !== 3 && sceneModal.type == '2')"
                                v-model="formValidate.projectId"
                                filterable
                                :placeholder="showScene ? '请选择场景工程' : `请选择${type === 17 ? '环境工程' : '工程'}`"
                                label-in-value
                                @on-change="getPrjName"
                                :disabled="sceneModal.type == '2' && type != 17"
                            >
                                <Option
                                    v-for="item in prjlists"
                                    :value="item.id"
                                    :key="item.id"
                                    :title="showScene ? item.projectname : item.name"
                                    :label="showScene ? item.projectname : item.name"
                                    >{{ showScene ? item.projectname : item.name }}
                                </Option>
                            </Select>
                            <Input v-else v-model="formValidate.projectName" disabled></Input>
                        </FormItem>
                        <FormItem
                            label="工程场景"
                            prop="id"
                            v-if="![1, 2, 4, 5, 8, 9, 17].includes(type)"
                            key="sceneId"
                        >
                            <Select filterable
                                v-model="formValidate.id"
                                filterable
                                :placeholder="testList.length === 0 && sceneModal.type == '2' ? '没有匹配到工程场景数据':'请选择场景'"
                                label-in-value
                                @on-change="getTestName"
                                :disabled="sceneModal.type == '2'"
                            >
                                <Option
                                    v-for="item in testList"
                                    :value="item.id"
                                    :key="item.id"
                                    :label="item.name"
                                    :title="item.name"
                                >
                                    {{ item.name }}
                                </Option>
                            </Select>
                        </FormItem>
                    </div>
                    <div v-if="sceneModal.tabName === 'template'">
                        <FormItem label="场景模板" prop="id" key="sceneTemplateId">
                            <Select filterable
                                v-model="formValidate.id"
                                filterable
                                placeholder="请选择场景模板"
                                @on-change="getSceneTemplateAccessGroup"
                            >
                                <Option
                                    v-for="item in templateList"
                                    :value="item.id"
                                    :label="item.name"
                                    :key="item.id"
                                    :title="item.name"
                                    >{{ item.name }}
                                </Option>
                            </Select>
                        </FormItem>
                        <FormItem
                            label="团队"
                            prop="accessGroupUsers"
                            v-show="templateAccessGroupList.length > 0"
                            key="accessGroupUsers"
                        >
                            <TeamConfig :groupList="templateAccessGroupList"></TeamConfig>
                        </FormItem>
                    </div>
                    <FormItem label="名称" prop="name">
                        <!-- placeholder="请输入中文、数字、字母、英文括号、下划线或者中划线，名称长度为1-64个字符" -->
                        <Input
                            v-model.trim="formValidate.name"
                            placeholder='不能包含下列任意英文字符 \ / : * ? " < > |，长度为1-128个字符'
                            :maxlength="128"
                        ></Input>
                    </FormItem>
                    <FormItem label="测试类型" prop="testType" key="testType" v-if="type === 17">
                        <Select filterable
                            v-model="formValidate.testType"
                            filterable
                            placeholder="请选择测试类型"
                        >
                            <Option :value="1">测试开发</Option>
                            <Option :value="2">产品测试</Option>
                            <Option :value="3">回归测试</Option>
                            <Option :value="4">比较测试</Option>
                        </Select>
                    </FormItem>
                    <FormItem label="关联资产" prop="testProduct" key="testProduct" v-if="type === 17">
                        <Select filterable
                            v-model="formValidate.testProduct"
                            filterable
                            placeholder="请选择关联资产"
                        >
                            <Option :value="product.id" v-for="product in productList" :key="product.id">{{product.name}}</Option>
                        </Select>
                    </FormItem>
                    <FormItem label="描述" prop="description">
                        <Input
                            v-model.trim="formValidate.description"
                            type="textarea"
                            :maxlength="200"
                            :autosize="{ minRows: 2, maxRows: 5 }"
                            placeholder="请输入描述"
                            :disabled="sceneModal.type == '2' && formValidate.progress == 2"
                        ></Input>
                    </FormItem>
                    <FormItem label="时间" prop="Dates">
                        <FormDatepicker 
                            v-model="formValidate.Dates" 
                            :disabled="sceneModal.type == '2' && formValidate.progress == 2"
                            @on-change="handleChangeDates">
                        </FormDatepicker>
                        <!-- <DatePicker
                            :editable="false"
                            type="datetimerange"
                            :value="formValidate.Dates"
                            format="yyyy-MM-dd HH:mm"
                            placement="bottom-start"
                            confirm
                            ref="datePicker"
                            placeholder="选择日期"
                            style="width: 280px"
                            transfer
                            :options="disabledOptions"
                            :disabled="sceneModal.type == '2' && formValidate.progress == 2"
                            @on-ok="clickOkBtn"
                            @on-clear="clickClearBtn"
                            @on-open-change="switchOpenChange"
                            @on-change="handleChangeDates"
                        ></DatePicker> -->
                        <p style="color: #ff9900; font-size: 10px; line-height: 2">
                            <Icon type="ios-information-circle-outline" />
                            选择同一天的时间段，请先双击要选择的日期
                        </p>
                        <p style="color: #ff9900; font-size: 10px; line-height: 2">
                            <Icon type="ios-information-circle-outline" />
                            开始时间不能小于当前时间
                        </p>
                        <p style="color: #ff9900; font-size: 10px; line-height: 2" v-if="type != 17">
                            <Icon type="ios-information-circle-outline" />
                            建议提前四小时配置环境
                        </p>
                        <p
                            style="color: #ff9900; font-size: 10px; line-height: 2"
                            v-if="type == 0 || type == 1 || type == 8"
                        >
                            <Icon type="ios-information-circle-outline" />
                            最长时间间隔为一周
                        </p>
                    </FormItem>
                    <FormItem label="图片" prop="logo" v-if="type !== 17">
                        <section>
                            <Row>
                                <!--<Col span="5" >-->
                                <Upload
                                    ref="upload"
                                    :action="uploadAction"
                                    :show-upload-list="false"
                                    :format="['jpg', 'jpeg', 'png']"
                                    :on-format-error="handleFormatError"
                                    :on-success="getImageUrl"
                                    :headers="uploadHeader"
                                >
                                    <Button
                                        icon="ios-cloud-upload-outline"
                                        :disabled="
                                            sceneModal.type == '2' && formValidate.progress == 2
                                        "
                                        >上传图片</Button
                                    >
                                    <img
                                        :src="iconSrc"
                                        style="
                                            width: auto;
                                            height: 40px;
                                            margin-left: 30px;
                                            vertical-align: middle;
                                        "
                                        v-if="formValidate.iconPath"
                                    />
                                    <!-- <WarningTip content="请上传jpg，jpeg，png格式图片"></WarningTip> -->
                                    <span
                                        style="color: #f90; position: absolute; top: 30px; left: 0"
                                    >
                                        <Icon type="ios-information-circle-outline" />
                                        支持jpg,jpeg,png格式图片</span
                                    >
                                </Upload>
                                <p v-if="showTip" style="color: red; position: relative; top: 24px">
                                    请上传jpg,jpeg,png格式图片
                                </p>
                                <div class="ivu-form-item-error-tip" v-if="uploaderror">
                                    请上传图片
                                </div>
                            </Row>
                        </section>
                    </FormItem>
                </div>
                <div v-if="sceneModal.tabName === 'custom'">
                    <div
                        class="form-gourp"
                        v-if="![4, 7, 10, 17].includes(type) && (type !== 5 || (type === 5 && extension === 1))"
                    >
                        <span class="form-title">记分策略</span>
                        <!-- <FormItem label="是否有基础分" prop="isBasicScore" v-if="type == 2"></FormItem>
                        <RadioGroup v-model="formValidate.isBasicScore">
                            <Radio :label=1>是</Radio>
                            <Radio :label=0>否</Radio>
                        </RadioGroup>
                        <span style="color:#f90"> <Icon type="ios-information-circle-outline"/> 是否使用基础分来计算得失分</span>
                    </FormItem> -->
                        <!-- 新护网 -->
                        <template v-if="type === 5 && extension === 1">
                            <FormItem label="防守方排名计算模式" prop="scoringType">
                                <RadioGroup v-model="formValidate.scoringType">
                                    <Radio :label=1 :disabled="sceneModal.type == '2' && ![0,1].includes(formValidate.progress)">模式一</Radio>
                                    <Radio :label=0 :disabled="sceneModal.type == '2' && ![0,1].includes(formValidate.progress)">模式二</Radio>
                                </RadioGroup>
                                <p style="color:#f90;">
                                    <Icon type="ios-information-circle-outline" />模式一：1000+500+一类靶标总分/一类个数+二类靶标总分/二类个数+加减分</p
                                >
                                <p style="color:#f90;">
                                    <Icon type="ios-information-circle-outline" />模式二：靶标总分+防守得分-攻击失分+加减分</p
                                >
                            </FormItem>
                        </template>
                        <!-- 攻防plus 计分模式 开始-->
                        <template v-if="type === 8">
                            <FormItem label="计分模式" prop="scoringType">
                                <RadioGroup v-model="formValidate.scoringType">
                                    <Radio :label=0 :disabled="sceneModal.type == '2' && ![0,1].includes(formValidate.progress)">攻防混合模式</Radio>
                                    <Radio :label=1 :disabled="sceneModal.type == '2' && ![0,1].includes(formValidate.progress)">攻防单独模式</Radio>
                                </RadioGroup>
                                <!-- <p style="color:#f90;">
                                    <Icon type="ios-information-circle-outline" />模式一：1000+500+一类靶标总分/一类个数+二类靶标总分/二类个数+加减分</p
                                >
                                <p style="color:#f90;">
                                    <Icon type="ios-information-circle-outline" />模式二：靶标总分+防守得分-攻击失分+加减分</p
                                > -->
                            </FormItem>
                        </template>
                         <!-- 攻防plus 计分模式 结束-->
                        <template v-else>
                            <template v-if="formValidate.isBasicScore == 1">
                                <FormItem label="一血得分" prop="oneScore">
                                    <InputNumber v-maxlength="6"
                                        :max="100"
                                        :min="1"
                                        v-model="formValidate.oneScore"
                                    ></InputNumber>
                                    <span style="color: #f90">
                                        <Icon type="ios-information-circle-outline" />
                                        每题首个得分的团队可获得的分值</span
                                    >
                                </FormItem>
                                <FormItem label="得分扣分比例" prop="basicDeduction">
                                    <InputNumber v-maxlength="6"
                                        :max="100"
                                        :min="1"
                                        v-model="formValidate.basicDeduction"
                                    ></InputNumber>
                                    %
                                </FormItem>
                            </template>
                            <template v-else>
                                <FormItem label="是否有激励分" prop="isExtraCredit" v-if="type == 2">
                                    <RadioGroup
                                        v-model="formValidate.isExtraCredit"
                                        @on-change="changeExtraCredit"
                                    >
                                        <Radio :label="1">是</Radio>
                                        <Radio :label="0">否</Radio>
                                    </RadioGroup>
                                    <span style="color: #f90">
                                        <Icon type="ios-information-circle-outline" />
                                        有激励分数的情况下，答题靠前的团队有对应得激励</span
                                    >
                                </FormItem>
                                <div
                                    v-if="showExtraCredit || formValidate.hlConfig == 2"
                                    style="margin-left: 64px"
                                >
                                    <p
                                        style="
                                            color: #ff9900;
                                            font-size: 10px;
                                            line-height: 2;
                                            margin-left: 32px;
                                        "
                                        v-if="formValidate.hlConfig == 2"
                                    >
                                        <Icon type="ios-information-circle-outline" />
                                        隐藏靶标分段计分且仅计分一次；公共和私有靶标按周期计分
                                    </p>
                                    <p class="levelConfig">
                                        <span v-if="formValidate.hlConfig == 2">第一分段</span
                                        ><span v-else>Top1</span>
                                        <FormItem
                                            label=" "
                                            prop="ExtraCredit1"
                                            :label-width="34"
                                            style="margin-left: 10px"
                                        >
                                            <div class="levelConfig-label levelConfig-label-small">
                                                团队数
                                            </div>
                                            <InputNumber v-maxlength="6"
                                                style="width: 130px"
                                                :max="100"
                                                :min="1"
                                                placeholder=""
                                                v-model="formValidate.ExtraCredit1"
                                            ></InputNumber>
                                        </FormItem>
                                        <FormItem
                                            label=" "
                                            prop="ExtraCreditValue1"
                                            :label-width="12"
                                            style="margin-left: 10px"
                                        >
                                            <div class="levelConfig-label levelConfig-label-long">
                                                <span v-if="formValidate.hlConfig == 2">分数</span
                                                ><span v-else>奖励分数(%)</span>
                                            </div>
                                            <InputNumber v-maxlength="6"
                                                style="width: 130px"
                                                :max="1000"
                                                :min="1"
                                                placeholder=""
                                                v-model="formValidate.ExtraCreditValue1"
                                            ></InputNumber>
                                        </FormItem>
                                    </p>
                                    <p class="levelConfig">
                                        <span v-if="formValidate.hlConfig == 2">第二分段</span
                                        ><span v-else>Top2</span>

                                        <FormItem
                                            label=" "
                                            prop="ExtraCredit2"
                                            :label-width="34"
                                            style="margin-left: 10px"
                                        >
                                            <div class="levelConfig-label levelConfig-label-small">
                                                团队数
                                            </div>
                                            <InputNumber v-maxlength="6"
                                                style="width: 130px"
                                                :max="100"
                                                :min="1"
                                                placeholder=""
                                                v-model="formValidate.ExtraCredit2"
                                            ></InputNumber>
                                        </FormItem>
                                        <FormItem
                                            label=" "
                                            prop="ExtraCreditValue2"
                                            :label-width="12"
                                            style="margin-left: 10px"
                                        >
                                            <div class="levelConfig-label levelConfig-label-long">
                                                <span v-if="formValidate.hlConfig == 2">分数</span
                                                ><span v-else>奖励分数(%)</span>
                                            </div>
                                            <InputNumber v-maxlength="6"
                                                style="width: 130px"
                                                :max="1000"
                                                :min="1"
                                                placeholder=""
                                                v-model="formValidate.ExtraCreditValue2"
                                            ></InputNumber>
                                        </FormItem>
                                    </p>
                                    <p class="levelConfig">
                                        <span v-if="formValidate.hlConfig == 2">第三分段</span
                                        ><span v-else>Top3</span>
                                        <FormItem
                                            label=" "
                                            prop="ExtraCredit3"
                                            :label-width="34"
                                            style="margin-left: 10px"
                                        >
                                            <div class="levelConfig-label levelConfig-label-small">
                                                团队数
                                            </div>
                                            <InputNumber v-maxlength="6"
                                                style="width: 130px"
                                                :max="100"
                                                :min="1"
                                                placeholder=""
                                                v-model="formValidate.ExtraCredit3"
                                            ></InputNumber>
                                        </FormItem>
                                        <FormItem
                                            label=" "
                                            prop="ExtraCreditValue3"
                                            :label-width="12"
                                            style="margin-left: 10px"
                                        >
                                            <div class="levelConfig-label levelConfig-label-long">
                                                <span v-if="formValidate.hlConfig == 2">分数</span
                                                ><span v-else>奖励分数(%)</span>
                                            </div>
                                            <InputNumber v-maxlength="6"
                                                style="width: 130px"
                                                :max="1000"
                                                :min="1"
                                                placeholder=""
                                                v-model="formValidate.ExtraCreditValue3"
                                            ></InputNumber>
                                        </FormItem>
                                    </p>
                                    <p class="levelConfig" v-if="formValidate.hlConfig == 2">
                                        剩余分段
                                        <FormItem
                                            label=" "
                                            prop="ExtraCreditValue4"
                                            :label-width="34"
                                            style="margin-left: 10px"
                                        >
                                            <div class="levelConfig-label levelConfig-label-small">
                                                分数
                                            </div>
                                            <InputNumber v-maxlength="6"
                                                style="width: 130px"
                                                :max="1000"
                                                :min="1"
                                                placeholder=""
                                                v-model="formValidate.ExtraCreditValue4"
                                            ></InputNumber>
                                        </FormItem>
                                    </p>
                                </div>
                            </template>
                        </template>
                        <FormItem
                            label="是否允许申请提示"
                            prop="isAllowApplicationPrompt"
                            v-if="[2, 9].includes(type) && formValidate.isBasicScore != 1"
                        >
                            <RadioGroup v-model="formValidate.isAllowApplicationPrompt">
                                <Radio :label="1">是</Radio>
                                <Radio :label="0">否</Radio>
                            </RadioGroup>
                            <span style="color: #f90">
                                <Icon type="ios-information-circle-outline" />
                                是否允许实验员申请提示</span
                            >
                        </FormItem>
                        <FormItem
                            label="申请提示扣分比例"
                            prop="ctfDeduction"
                            v-if="
                                [2, 8, 9].includes(type) &&
                                formValidate.isAllowApplicationPrompt == 1 &&
                                formValidate.isBasicScore != 1
                            "
                        >
                            <InputNumber v-maxlength="6"
                                style="width: 130px"
                                :max="100"
                                :min="1"
                                placeholder=""
                                v-model="formValidate.ctfDeduction"
                            ></InputNumber>
                            %
                            <span style="color: #f90">
                                <Icon type="ios-information-circle-outline" />
                                每次申请提示，将按该比例扣除相应得分</span
                            >
                        </FormItem>
                        <!-- 与下面的targetScore区分开来，所以使用targetScore1，只是用于表单复原，没有其他作用 -->
                        <FormItem
                            label="目标分数（分）"
                            prop="high"
                            v-if="type == 5 && (extension === 0 || extension === 3)"
                        >
                            <div class="score-div">
                                <div>
                                    <span>高危</span
                                    ><InputNumber v-maxlength="6"
                                        v-model="formValidate.high"
                                        style="width: 200px"
                                        :max="100"
                                        :min="1"
                                    />
                                </div>
                            </div>
                        </FormItem>
                        <FormItem label="" prop="middle" v-if="type == 5 && (extension === 0 || extension === 3)">
                            <div class="score-div">
                                <div>
                                    <span>中危</span
                                    ><InputNumber v-maxlength="6"
                                        v-model="formValidate.middle"
                                        style="width: 200px"
                                        :max="100"
                                        :min="1"
                                    />
                                </div>
                            </div>
                        </FormItem>
                        <FormItem label="" prop="low" v-if="type == 5 && (extension === 0 || extension === 3)">
                            <div class="score-div">
                                <div>
                                    <span>低危</span
                                    ><InputNumber v-maxlength="6"
                                        v-model="formValidate.low"
                                        style="width: 200px"
                                        :max="100"
                                        :min="1"
                                    />
                                </div>
                            </div>
                        </FormItem>
                        <!-- 将原来弃用的字段用于保存单位基础分，所以还是使用原来的变量命名 -->
                        <FormItem
                            label="单位基础分（分）"
                            prop="targetScore"
                            v-if="type == 5 && (extension === 0 || extension === 3)"
                        >
                            <InputNumber v-maxlength="6"
                                :min="1"
                                :max="10000"
                                v-model="formValidate.targetScore"
                                placeholder="请输入整数"
                                style="width: 200px"
                            ></InputNumber>
                        </FormItem>
                        <FormItem
                            label="周期时长（分钟）"
                            prop="cycleTime"
                            v-if="type == 0 || type == 1 || type == 8"
                        >
                            <InputNumber v-maxlength="3"
                                v-model="formValidate.cycleTime"
                                :min="1"
                                :max="100"
                                placeholder="请输入1-100的整数"
                                style="width: 200px"
                            ></InputNumber>
                        </FormItem>
                        <!-- 攻防plus的单独计分模式没有周期异常扣分 -->
                        <FormItem
                            :label="type == 8 ? '周期异常扣分' : '周期分数'"
                            prop="cycleScore"
                            v-if="
                                type == 1 || (type == 8 && formValidate.scoringType == 0) || (type == 0 && formValidate.hlConfig == 2)
                            "
                        >
                            <InputNumber v-maxlength="6"
                                :min="1"
                                :max="1000"
                                v-model="formValidate.cycleScore"
                                placeholder="请输入1-1000的整数"
                                style="width: 200px"
                            ></InputNumber>
                            <span style="color: #ff9900; font-size: 10px"
                                ><Icon type="ios-information-circle-outline" /> 默认{{
                                    type == 8 ? 100 : 10
                                }}分</span
                            >
                        </FormItem>
                        <FormItem label="基础分数" prop="basicScore" v-if="type == 8 && formValidate.scoringType == 0">
                            <InputNumber v-maxlength="6"
                                :min="1"
                                :max="100000"
                                v-model="formValidate.basicScore"
                                placeholder="请输入1-100000的整数"
                                style="width: 200px"
                            ></InputNumber>
                            <span style="color: #ff9900; font-size: 10px"
                                ><Icon type="ios-information-circle-outline" /> 默认5000分</span
                            >
                        </FormItem>
                        <FormItem label="无责重置次数" prop="enResetNum" v-if="type == 8 && formValidate.scoringType == 0">
                            <InputNumber v-maxlength="6"
                                :min="1"
                                :max="10"
                                v-model="formValidate.enResetNum"
                                placeholder="请输入1-10的整数"
                                style="width: 200px"
                            ></InputNumber>
                            <span style="color: #ff9900; font-size: 10px"
                                ><Icon type="ios-information-circle-outline" /> 默认3次</span
                            >
                        </FormItem>
                        <FormItem label="超额重置扣分" prop="resetLostScore" v-if="type == 8 && formValidate.scoringType == 0">
                            <InputNumber v-maxlength="4"
                                :min="1"
                                :max="1000"
                                v-model="formValidate.resetLostScore"
                                placeholder="请输入1-1000的整数"
                                style="width: 200px"
                            ></InputNumber>
                            <span style="color: #ff9900; font-size: 10px"
                                ><Icon type="ios-information-circle-outline" /> 默认100分</span
                            >
                        </FormItem>
                        <template v-if="type == 8 && formValidate.scoringType == 1">
                            <FormItem label="每题最低分数" prop="questionMinScore" v-if="type == 8 && formValidate.scoringType == 1">
                                <InputNumber v-maxlength="6"
                                    :min="1"
                                    :max="999999"
                                    v-model="formValidate.questionMinScore"
                                    placeholder="请输入整数"
                                    style="width: 200px"
                                ></InputNumber>
                                <span style="color: #ff9900; font-size: 10px"
                                    ><Icon type="ios-information-circle-outline" /> 默认300分</span
                                >
                            </FormItem>
                            <FormItem label="每题允许提交防御次数" prop="questionAllowDefendCount">
                                <InputNumber v-maxlength="6"
                                    :min="1"
                                     :max="999999"        
                                    v-model="formValidate.questionAllowDefendCount"
                                    placeholder="请输入整数"
                                    style="width: 200px"
                                ></InputNumber>
                                <span style="color: #ff9900; font-size: 10px"
                                    ><Icon type="ios-information-circle-outline" /> 默认10次</span
                                >
                            </FormItem>
                            <FormItem label="每题每次提交防御报告间隔" prop="submitTime">
                                <InputNumber v-maxlength="6"
                                    :min="1" :max="999999"
                                    v-model="formValidate.submitTime"
                                    placeholder="请输入整数"
                                    style="width: 200px"
                                ></InputNumber>
                                <span style="color: #ff9900; font-size: 10px"
                                    ><Icon type="ios-information-circle-outline" /> 默认1分钟</span
                                >
                            </FormItem>
                            <!-- <FormItem label="最低得分的团队设置" prop="minTeamScore">
                                <InputNumber v-maxlength="6"
                                    :min="1"
                                    :max="1000"
                                    v-model="formValidate.minTeamScore"
                                    placeholder="请输入1-1000的整数"
                                    style="width: 200px"
                                ></InputNumber>
                                <span style="color: #ff9900; font-size: 10px"
                                    ><Icon type="ios-information-circle-outline" /> 默认100</span
                                >
                            </FormItem> -->
                            <FormItem label="曲线降低速率" prop="curveDecelerateRate">
                                <InputNumber v-maxlength="6"
                                    :min="1"
                                    :max="999999"
                                    v-model="formValidate.curveDecelerateRate"
                                    placeholder="请输入整数"
                                    style="width: 200px"
                                ></InputNumber>
                                <span style="color: #ff9900; font-size: 10px"
                                    ><Icon type="ios-information-circle-outline" /> 默认5</span
                                >
                            </FormItem>
                            <template v-for="(item,index) in formValidate.attackTimeframe">
                                <FormItem 
                                    :key="`attack-${index}`"
                                    :label="index === 0 ? '攻击时段：' : ''"
                                    :prop="'attackTimeframe.' + index + '.time'"
                                    :rules="[{required: true, type:'array',min:2,max:2,message: '请选择时间', trigger: 'change'},{
                                        validator:(rule, value, callback) => validateTime(rule, value, callback,{...item,index,type:'attack'})}]">
                                    <div class="flex">
                                        <FormDatepicker v-model="item.time" :min="formValidate.Dates[0]" :max="formValidate.Dates[1]"  @on-change="(time) => changeTimeframe(time,item,'attack')"></FormDatepicker>
                                        <!-- <DatePicker
                                            :editable="false"
                                            type="datetimerange"
                                            :value="item.time"
                                            format="yyyy-MM-dd HH:mm"
                                            placement="bottom-start"
                                            ref="datePicker"
                                            placeholder="选择日期"
                                            style="width: 280px"
                                            transfer
                                            :options="disableTimeframedOptions"
                                            transfer-class-name="noConfirm"
                                            @on-change="(time) => changeTimeframe(time,item,'attack')"
                                        ></DatePicker> -->
                                        <Button v-if="index === 0" icon="md-add" class="ml10" style="padding:0" @click.prevent="addTimeFrame('attack')"></Button>
                                        <Button v-else icon="md-remove" class="ml10" style="padding:0" @click.prevent="removeTimeFrame('attack',index)"></Button>
                                    </div>
                                </FormItem>
                                <div v-if="index === formValidate.attackTimeframe.length - 1" style="margin-left: 120px;margin-bottom: 20px;">
                                    <p style="color: #ff9900; font-size: 10px; line-height: 2">
                                        <Icon type="ios-information-circle-outline" />
                                        选择同一天的时间段，请先双击要选择的日期
                                    </p>
                                    <p style="color: #ff9900; font-size: 10px; line-height: 2">
                                        <Icon type="ios-information-circle-outline" />
                                        开始时间不能小于比赛开始时间,结束时间不能大于比赛结束时间
                                    </p>
                                    <p style="color: #ff9900; font-size: 10px; line-height: 2">
                                        <Icon type="ios-information-circle-outline" />
                                        攻击防守各时段时间不能冲突
                                    </p>
                                </div>
                            </template>
                            <template v-for="(item,index) in formValidate.defendTimeframe">
                                <FormItem 
                                    :key="`defend-${index}`"
                                    :label="index === 0 ? '防守时段：' : ''"
                                    :prop="'defendTimeframe.' + index + '.time'"
                                    :rules="[{required: true, type:'array',min:2,max:2,message: '请选择时间', trigger: 'change'},{
                                        validator:(rule, value, callback) => validateTime(rule, value, callback,{...item,index,type:'defend'})}]">
                                    <div class="flex">
                                        <FormDatepicker v-model="item.time" :min="formValidate.Dates[0]" :max="formValidate.Dates[1]"  @on-change="(time) => changeTimeframe(time,item,'defend')"></FormDatepicker>
                                        <!-- <DatePicker
                                            :editable="false"
                                            type="datetimerange"
                                            :value="item.time"
                                            format="yyyy-MM-dd HH:mm"
                                            placement="bottom-start"
                                            ref="datePicker"
                                            placeholder="选择日期"
                                            style="width: 280px"
                                            transfer
                                            :options="disableTimeframedOptions"
                                            transfer-class-name="noConfirm"
                                            @on-change="(time) => changeTimeframe(time,item,'defend')"
                                        ></DatePicker> -->
                                        <Button v-if="index === 0" icon="md-add" class="ml10" style="padding:0" @click.prevent="addTimeFrame('defend')"></Button>
                                        <Button v-else icon="md-remove" class="ml10" style="padding:0" @click.prevent="removeTimeFrame('defend',index)"></Button>
                                    </div>
                                </FormItem>
                                <div v-if="index === formValidate.defendTimeframe.length - 1" style="margin-left: 120px;margin-bottom: 20px;">
                                    <p style="color: #ff9900; font-size: 10px; line-height: 2">
                                        <Icon type="ios-information-circle-outline" />
                                        选择同一天的时间段，请先双击要选择的日期
                                    </p>
                                    <p style="color: #ff9900; font-size: 10px; line-height: 2">
                                        <Icon type="ios-information-circle-outline" />
                                        开始时间不能小于比赛开始时间,结束时间不能大于比赛结束时间
                                    </p>
                                    <p style="color: #ff9900; font-size: 10px; line-height: 2">
                                        <Icon type="ios-information-circle-outline" />
                                        攻击防守各时段时间不能冲突
                                    </p>
                                </div>
                            </template>
                            <!-- :disabled="sceneModal.type == '2' && formValidate.progress == 2"
                                        @on-ok="clickOkBtn"
                                        @on-clear="clickClearBtn"
                                        @on-open-change="switchOpenChange"
                                        @on-change="changeDates" -->
                        </template>
                    </div>
                    <div class="form-gourp" v-if="type == 0 && $store.state.common.showDistributed">
                        <span class="form-title">演练模式</span>
                        <FormItem
                            label="是否为分布式"
                            prop="isDistributed"
                            v-if="[0, 2, 7].includes(type) && $store.state.common.showDistributed"
                        >
                            <RadioGroup
                                v-model="formValidate.isDistributed"
                                @on-change="changeIsDistributed"
                            >
                                <Radio
                                    :label="1"
                                    :disabled="
                                        sceneModal.type == '2' ||
                                        isDistributedDesigner() ||
                                        isDistributedChoose
                                    "
                                    >是</Radio
                                >
                                <Radio
                                    :label="0"
                                    :disabled="
                                        sceneModal.type == '2' ||
                                        isDistributedDesigner() ||
                                        isDistributedChoose
                                    "
                                    >否</Radio
                                >
                            </RadioGroup>
                        </FormItem>
                    </div>
                    <!-- <div class="form-gourp" v-if="type != 0 && type != 10 && !(type == 5 && extension == 3)"> -->
                        <!-- 条件新增 1,8 攻防赛 ，攻防plus 下 竞赛不需要配置子网，下面为空，可以屏蔽该边框  -->
                    <div class="form-gourp" v-if="![0,10,1,8,17].includes(type) && !(type == 5 && extension == 3)">
                        <span class="form-title">{{
                            `${[1, 2, 3, 8, 9].includes(type) ? '竞赛' : '演练'}模式`
                        }}</span>
                        <!--渗透演练、综合演练、夺旗赛需要设置提交报告模式-->
                        <FormItem
                            label="提交报告模式"
                            prop="wpUpMode"
                            v-if="[2, 4, 7, 9].includes(type)"
                        >
                            <RadioGroup
                                v-model="formValidate.wpUpMode"
                                @on-change="formValidate.scoreMode = 0"
                            >
                                <Radio :label="1" :disabled="sceneModal.type == '2'">{{
                                    `针对${[2, 9].includes(type) ? '竞赛' : '演练'}提交`
                                }}</Radio>
                                <Radio :label="2" :disabled="sceneModal.type == '2'">{{
                                    `针对${[7, 10].includes(type) ? '任务' : '题目'}提交`
                                }}</Radio>
                            </RadioGroup>
                        </FormItem>
                        <!--综合演练需要设置是否分布式模式-->
                        <FormItem
                            label="是否为分布式"
                            prop="isDistributed"
                            v-if="[0, 2, 7].includes(type) && $store.state.common.showDistributed"
                        >
                            <RadioGroup
                                v-model="formValidate.isDistributed"
                                @on-change="changeIsDistributed"
                            >
                                <Radio
                                    :label="1"
                                    :disabled="
                                        sceneModal.type == '2' ||
                                        isDistributedDesigner() ||
                                        isDistributedChoose
                                    "
                                    >是</Radio
                                >
                                <Radio
                                    :label="0"
                                    :disabled="
                                        sceneModal.type == '2' ||
                                        isDistributedDesigner() ||
                                        isDistributedChoose
                                    "
                                    >否</Radio
                                >
                            </RadioGroup>
                        </FormItem>
                        <!--渗透演练或综合演练需要设置答题模式-->
                        <FormItem label="答题模式" prop="stMode" v-if="type == 4 || type == 7">
                            <RadioGroup
                                v-model="formValidate.stMode"
                                @on-change="formValidate.scoreMode = 0"
                            >
                                <Radio :label="1" :disabled="sceneModal.type == '2' || stMode"
                                    >随意答题</Radio
                                >
                                <Radio :label="0" :disabled="sceneModal.type == '2'"
                                    >顺序答题</Radio
                                >
                            </RadioGroup>
                        </FormItem>
                        <!--综合演练针对任务提交随意答题需要设置计分模式-->
                        <FormItem
                            label="计分模式"
                            prop="scoreMode"
                            v-if="
                                type == 7 && formValidate.stMode == 1 && formValidate.wpUpMode == 2
                            "
                        >
                            <RadioGroup v-model="formValidate.scoreMode">
                                <Radio :label="1">累加</Radio>
                                <Radio :label="0">单次</Radio>
                            </RadioGroup>
                        </FormItem>
                        <FormItem label="竞赛模式" prop="onlineMode" v-if="type == 2">
                            <RadioGroup
                                v-model="formValidate.onlineMode"
                                @on-change="queryPublicSubnets"
                            >
                                <Radio :label="1" :disabled="sceneModal.type == '2'">线上</Radio>
                                <Radio :label="0" :disabled="sceneModal.type == '2'">线下</Radio>
                            </RadioGroup>
                            <!--<span style="color:#f90"> <Icon type="ios-information-circle-outline" /> 用于在演练页面的展示控制</span>-->
                        </FormItem>
                        <!-- 共享环境就是全部是没有环境的提题目,通过系统参数控制是否显示此项 -->
                        <FormItem label="环境类型" prop="envType" v-if="type == 2 && showCtfEnvType">
                            <RadioGroup v-model="formValidate.envType" prop="envType">
                                <Radio :label="1" :disabled="sceneModal.type == '2'">独享环境</Radio>
                                <Radio :label="0" :disabled="sceneModal.type == '2'">共享环境</Radio> 
                            </RadioGroup>
                        </FormItem>
                        <!-- <FormItem label="部署模式" prop="deployMode"
                        v-if="(formValidate.onlineMode == 0 && type == 2) || type == 5 || type == 1 || type == 8 || type == 9">
                        <RadioGroup v-model="formValidate.deployMode" @on-change="queryPublicSubnets">
                            <Radio :label="1" :disabled="sceneModal.type == '2'">数据通道模式</Radio>
                            <Radio :label="2" :disabled="sceneModal.type == '2'">路由模式</Radio>
                        </RadioGroup>
                    </FormItem> -->
                    <!-- 新护网不要 -->
                        <FormItem label="是否可更换外网IP" prop="hwChangeIp" v-if="type == 5 && ![1,2,4].includes(extension)"> 
                            <RadioGroup v-model="formValidate.hwChangeIp">
                                <Radio
                                    label="1"
                                    :disabled="sceneModal.type == '2' && formValidate.progress == 2"
                                    >是</Radio
                                >
                                <Radio
                                    label="0"
                                    :disabled="sceneModal.type == '2' && formValidate.progress == 2"
                                    >否</Radio
                                >
                            </RadioGroup>
                        </FormItem>
                        <!-- <FormItem label="切换ip" prop="hwChangeIp"  v-if="type==5&&extension==1"> 
                            <RadioGroup v-model="formValidate.hwChangeIp">
                                <Radio
                                    label="1"
                                    >是</Radio
                                >
                                <Radio
                                    label="0"
                                    >否</Radio
                                >
                            </RadioGroup>
                        </FormItem> -->
                        <FormItem label="ip类型" prop="typeIp"  v-if="type==5&&extension==1"> 
                            <RadioGroup v-model="formValidate.typeIp" @on-change="handleRadioChange">
                                <Radio
                                    label="1211"
                                     :disabled="sceneModal.type != '1'"
                                    >公网ip</Radio
                                >
                                <Radio
                                    label="1212"
                                     :disabled="sceneModal.type != '1'"
                                    >公有云ip</Radio
                                >
                            </RadioGroup>
                        </FormItem>
                        <FormItem label="团队公网ip数" prop="teamIpCount"  v-if="(type==5&&extension==1)&&formValidate.typeIp=='1211'"> 
                            <Input type="text" v-model="formValidate.teamIpCount" placeholder="请输入"  :disabled="sceneModal.type != '1'"></Input>
                        </FormItem>
                        <!-- <FormItem
                            label="公网子网"
                            prop='publicSubnetId'
                            v-if="
                                (type == 2 ||
                                    type == 1 ||
                                    type == 8 ||
                                    type == 9 ||
                                    (type == 5 && (extension === 1 || extension === 2))) &&
                                (formValidate.onlineMode == 1 || formValidate.deployMode === 2)
                            "
                        >
                            <Select filterable
                                v-model="formValidate.publicSubnetId"
                                :placeholder='(type==5&&extension==1)&&formValidate.typeIp!="1212"?"请选择子网(多选)":"请选择子网"'
                                filterable
                                :disabled="sceneModal.type != '1'"
                                @on-change="getAvailableIP"
                                :multiple='(type==5&&extension==1)&&formValidate.typeIp!="1212"'
                            >
                                <Option
                                    v-for="item in publicSubnets"
                                    :value="item.id"
                                    :key="item.id"
                                    >名称：{{ item.name }}CIDR：{{ item.cidr }}</Option
                                >
                            </Select>
                        </FormItem> -->
                        <!-- 优化条件写法 1：攻防赛 2：夺旗赛  8：攻防plus  9:运维赛 通过运维配置获取公网子网ID -->
                        <FormItem
                            label="公网子网"
                            prop='publicSubnetId'
                            v-if="(type == 2 && formValidate.onlineMode == 1) || (type == 5 && (extension === 1 || extension === 2 || extension === 4)) && (formValidate.onlineMode == 1 || formValidate.deployMode === 2) "
                        >
                            <Select filterable
                                v-model="formValidate.publicSubnetId"
                                :placeholder='(type==5&&extension==1)&&formValidate.typeIp!="1212"?"请选择公网子网(多选)":"请选择公网子网"'
                                filterable
                                :disabled="sceneModal.type != '1'"
                                @on-change="getAvailableIP"
                                :multiple='(type==5&&extension==1)&&formValidate.typeIp!="1212"'
                            >
                                <Option
                                    v-for="item in publicSubnets"
                                    :value="item.id"
                                    :key="item.id"
                                    >名称：{{ item.name }}CIDR：{{ item.cidr }}</Option
                                >
                            </Select>
                        </FormItem>
                        <FormItem
                            label="网关IP"
                            prop="outsideGatewayIP"
                            v-if="
                                type == 2 && formValidate.onlineMode == 1 && sceneModal.type == '1' && false
                            "
                        >
                            <Input v-model.trim="formValidate.outsideGatewayIP" disabled></Input>
                        </FormItem>
                        <FormItem
                            label="外网IP"
                            v-if="
                                type == 2 && formValidate.onlineMode == 1 && sceneModal.type == '2'
                            "
                        >
                            {{ formValidate.outsideIP }}
                        </FormItem>
                        <FormItem
                            label="网关IP"
                            v-if="
                                type == 2 && formValidate.onlineMode == 1 && sceneModal.type == '2'
                            "
                        >
                            {{ formValidate.outsideGatewayIP }}
                        </FormItem>
                        <FormItem label="是否盲打" prop="isBlindPlay" v-if="type == 2">
                            <RadioGroup v-model="formValidate.isBlindPlay">
                                <Radio :label="1">是</Radio>
                                <Radio :label="0">否</Radio>
                            </RadioGroup>
                        </FormItem>
                        <FormItem
                            label="盲打模式"
                            prop="touchType"
                            v-if="
                                type == 2 &&
                                formValidate.isBlindPlay == 1 &&
                                formValidate.isBasicScore == 0
                            "
                        >
                            <RadioGroup v-model="formValidate.touchType">
                                <Radio :label="1" :disabled="sceneModal.type == '2'"
                                    >无法查看排行榜</Radio
                                >
                                <Radio :label="2" :disabled="sceneModal.type == '2'"
                                    >无法得知答题正确性</Radio
                                >
                            </RadioGroup>
                        </FormItem>
                        <!-- <FormItem
                            label="结束后清空工程"
                            prop="endClearConfig"
                            v-if="!((type == 5 && extension == 3) || type == 17)"
                        >
                            <RadioGroup v-model="formValidate.endClearConfig">
                                <Radio :label="1"
                                    >是</Radio
                                >
                                <Radio :label="0"
                                    >否</Radio
                                >
                            </RadioGroup>
                        </FormItem> -->
                        <!-- <FormItem label="是否使用大组" prop="isSupergroup" v-if="type == 2 && formValidate.isBasicScore != 1">
                        <RadioGroup v-model="formValidate.isSupergroup">
                            <Radio :label=1>是</Radio>
                            <Radio :label=0>否</Radio>
                        </RadioGroup>
                        <span style="color:#f90"> <Icon type="ios-information-circle-outline"/> 是否通过大组计算排名</span>
                    </FormItem> -->
                    </div>
                </div>
            </Form>
        </Modal>
        <quick-creat ref="quickCreatModal" @getCompetList="getSceneList" :type="type"></quick-creat>
        <QuickCreateDrill
            ref="quickCreatDrillModal"
            @getCompetList="getSceneList"
            :type="type"
            :hwType="extension"
        ></QuickCreateDrill>
        <Modal v-model="delDrillModal" width="300">
            <p slot="header" style="color: #f60">
                <Icon type="ios-information-circle-outline"></Icon>
                <span>确认删除</span>
            </p>
            <div v-show="hasProject">
                {{ showScene ? '是否删除场景工程:' : '是否删除工程:' }}
                <RadioGroup v-model="enableDelProject">
                    <Radio :label="1">
                        <span>是</span>
                    </Radio>
                    <Radio :label="0">
                        <span>否</span>
                    </Radio>
                </RadioGroup>
                <div style="margin-top:10px" v-if="showDelLoophole && false">
                    <span>是否删除漏洞:</span>
                    <RadioGroup v-model="delLoophole">
                    <Radio :label="1">
                        <span>是</span>
                    </Radio>
                    <Radio :label="0">
                        <span>否</span>
                    </Radio>
                </RadioGroup>
                </div>
            </div>
            <div v-show="!hasProject">是否确认删除</div>
            <div slot="footer">
                <Button type="default" @click="closeDelModal">取消</Button>
                <Button type="error" :loading="delModalLoading" @click="delScene">删除</Button>
            </div>
        </Modal>
        <!-- 生成模板 -->
        <GengrateTemplateModal
            v-model="generateTemplateModal.show"
            :sceneId="generateTemplateModal.sceneId"
        ></GengrateTemplateModal>
        <Modal
        v-model="showModal"
        :title="`${title}统计信息`"
        :mask-closable="false"
        :width="800"
        footer-hide
        @on-visible-change="colseVisibleChange"
        >
            <monthlyAnalysis 
                v-if="showModal"      
                :type="type" 
                :hwType="extension"
            />
        </Modal>
         <!-- 项目信息 -->
        <Modal v-model="projectInfoModal" :title="`${projectInfo.secenName}-项目信息`" :mask-closable="false" :width="800" footer-hide>
            <div id="projectInfo">
                <p><span class='label'>创建者</span><span>{{projectInfo.creatorName}}</span></p>
                <p><span class='label'>联系人名称</span><span>{{projectInfo.nickname}}</span></p>
                <p><span class='label'>联系人昵称</span><span>{{projectInfo.nickname}}</span></p>
                <p><span class='label'>联系人电话</span><span>{{projectInfo.mobile}}</span></p>
                <p><span class='label'>联系人邮箱</span><span>{{projectInfo.email}}</span></p>
                <p><span class='label'>开始时间</span><span>{{projectInfo.startTime}}</span></p>
                <p><span class='label'>结束时间</span><span>{{projectInfo.endTime}}</span></p>
                <p><span class='label'>测试目的</span><span>{{projectInfo.purpose}}</span></p>
          </div>
        </Modal>

        <!-- 攻击行业/严重度 -->
        <Modal v-model="statisticsIndustryModal" :title="`${industryStatisticsInfo.name}-攻击目标单位行业及严重程度`" :mask-closable="false" :width="800" footer-hide>
          <div id="statisticsIndustrydiv" style="height: 500px;">
            <div v-show="echartIndustryData && echartIndustryData.length>0" id="industrychart" class="echart"
            style="height: 450px;width: 700px;"
            />
            <div v-if="echartIndustryData && echartIndustryData.length>0"></div>
            <NoData v-else text="暂无数据"></NoData>
          </div>
        </Modal>
      
      
        <!-- 漏洞统计 -->
        <Modal v-model="vulneraStatisticsModal" :title="`${vulneraStatisticsInfo.name}-漏洞统计`" :mask-closable="false" :width="800" footer-hide>
            <div id="vulneraStatisticsInfo">
                <p><span class='label'>高危</span><span>{{vulneraStatisticsInfo.high}}</span></p>
                <p><span class='label'>中危</span><span>{{vulneraStatisticsInfo.middle}}</span></p>
                <p><span class='label'>低危</span><span>{{vulneraStatisticsInfo.low}}</span></p>
          </div>
        </Modal>
        <!-- 漏洞结果 -->
        <Modal v-model="resultInfoModal" :title="`${resultInfo.name}-漏洞结果`" :mask-closable="false" :width="1300" footer-hide class-name="resultInfoModal">
           <vulnerabilityStatistics v-if="resultInfoModal" :sceneId="resultInfo.id" :projectId="resultInfo.projectId"/>
           <!-- <TableList
                v-if="resultInfoModal"
                ref="resultInfo"
                :columns="resultColumns"
                :data="resultDataList"
                :total="resultTotal"
                :page.sync="resultPageIndex"
                :size.sync="resultPageSize"
                @queryFun="getResultList"
            ></TableList> -->
        </Modal>
        <Modal v-model="createProModal" title="构建工程" footer-hide class="drawer-low-modal">
            <creatPro 
                v-if="createProModal"
                pro-id=""
                pro-name="" 
                :message="false"
                @creatProModalStatus="bindPro"></creatPro>
        </Modal>
        <QuestionModal ref="questionModal"></QuestionModal>
    </MenuPage>
</template>

<script>



import NoData from '@/components/common/noDataPage.vue'
import G2 from "@antv/g2";
import { queryDistributed } from '@/api/user';
import { getDictInfoByName } from '@/api/dict';
import {
    addScene,
    modifyScene,
    delScene,
    getSceneList,
    getTests,
    getProjects,
    quickCreateProgress,
    getBatchDeployProgress,
    reQuickCreateContent,
    getSceneProject,
    queryPublicSubnets,
    getAvailableIP,
    getSceneCycleNum,
    screenCopyTo,
    sceneFiling,
    getFilingList,
    getCopyProgress,
    getFZInformation
} from '@/api/drill_compete';
import { ctfTeamRankStatis } from '@/api/compitionStatic.js'
import {queryProductGroupList} from '@/view/testPlatform/asset/api/productGroup.js'
import {getVulLevel4ContestNum,getVul4ContestPage} from '@/api/product.js';
import encryption from '@/libs/encryption.js';
import quickCreat from './qiuckCreate/quickCreate';
import QuickCreateDrill from '@/view/drill_compete/page/qiuckCreate/quick-create-drill';
import DrillList from './drillList';
import GengrateTemplateModal from './sceneTemplate/edit.vue';
import TeamConfig from './sceneTemplate/teamConfig.vue';
import FormDatepicker from '@/components/common/form-datepicker'
import recoverTime from '@/mixin/recoverTime';
import { sceneTemplateMixin, validateTeam } from './sceneTemplate/createMixin';
import { parseJson, debounce } from '@/libs/utils';
// import { validateName } from '@/libs/reg';
import { validateName1,validateName128,nameErrorTip,getNumReg} from '@/libs/reg';
import { sceneCol } from './drillCol.js'
import monthlyAnalysis from '@/view/drill_compete/page/componentHW/monthlyAnalysis.vue';
import vulnerabilityStatistics from '@/view/drill_compete/page/statistics/vulnerabilityStatistics.vue';
import creatPro from '@/components/creatPage/creatProject'; 
import QuestionModal from './questionModal.vue'
import {reportStatisticIndustry} from "@/api/referee";
import {mapState,mapGetters} from "vuex";
import {getDirectionForSelect} from "../../../api/achievements";
export default {
    name: 'scenesDrill',
    props: ['type', 'extension'],
    components: { NoData,quickCreat, DrillList, QuickCreateDrill, GengrateTemplateModal, TeamConfig,FormDatepicker,monthlyAnalysis,vulnerabilityStatistics,creatPro,QuestionModal },
    mixins: [recoverTime, sceneTemplateMixin, sceneCol],
    directives: {
      maxlength: {
        inserted(el, binding) {
          if(el.children && el.children[1] && el.children[1].children && el.children[1].children[0])
            el.children[1].children[0].setAttribute('maxlength', binding.value);
        }
      }
    },
    data() {
        let September = sessionStorage.getItem('November');
        September = JSON.parse(encryption.SelfUseDecrypt(September));
        const validateTargetScore = (rule, value, callback) => {
            if (value) {
                if (!Number.isInteger(value)) {
                    callback(new Error('请输入整数'));
                } else {
                    if (value < 0) {
                        callback(new Error('请输入正数'));
                    } else {
                        callback();
                    }
                }
            } else {
                callback(new Error('不能为空'));
            }
        };
        const validaPublicSubnet = (rule,value,callback)=>{
            if(value.length){
                callback()
            }else{
                callback(new Error('不能为空'))
            }
        }
        // 验证0~100的数组，允许为空
        const validateNum = (rule, value, callback) => {
            if (value !== 0 && !value) {
                callback(new Error('不能为空'));
                return;
            }
            if (!Number.isInteger(value)) {
                callback(new Error('请输入整数'));
                return;
            }
            if (value <= 0 || value > 100) {
                callback(new Error('请输入1-100的整数'));
                return;
            }
            callback();
        };
        const validateNum100000 = (rule, value, callback) => {
            if (value !== 0 && !value) {
                callback(new Error('不能为空'));
                return;
            }
            if (!Number.isInteger(value)) {
                callback(new Error('请输入整数'));
                return;
            }
            if (value <= 0 || value > 100000) {
                callback(new Error('请输入1-100000的整数'));
                return;
            }
            callback();
        };
         const validateIsNumber = (rule, value, callback) => {
             if (value !== 0 && !value) {
                callback(new Error('不能为空'));
                return;
            }
            if (value < 2 || value>100) {
                callback(new Error('最少为2,最大不能超过100'));
                return;
            }
            const regex = /^[1-9]\d*$/;
            if (!regex.test(value)) {
                callback(new Error('请输入整数'));
                return;
            }
            callback();
        };
        
        const validateNum10 = (rule, value, callback) => {
            if (value !== 0 && !value) {
                callback(new Error('不能为空'));
                return;
            }
            if (!Number.isInteger(value)) {
                callback(new Error('请输入整数'));
                return;
            }
            if (value <= 0 || value > 10) {
                callback(new Error('请输入1-10的整数'));
                return;
            }
            callback();
        };
        const validateNum1000 = (rule, value, callback) => {
            if (value !== 0 && !value) {
                callback(new Error('不能为空'));
                return;
            }
            if (!Number.isInteger(value)) {
                callback(new Error('请输入整数'));
                return;
            }
            if (value <= 0 || value > 1000) {
                callback(new Error('请输入1-1000的整数'));
                return;
            }
            callback();
        };
        // 验证时间选择是否正确
        const validateDate = (rule, value, callback) => {
            if (value) {
                let startTime = this.formValidate.Dates[0];
                let endTime = this.formValidate.Dates[1];
                if (!startTime || !endTime) {
                    callback(new Error('请选择时间'));
                } else if (
                    this.formValidate.progress != 2 &&
                    new Date(startTime).getTime() < new Date().getTime()
                ) {
                    callback(new Error('开始时间必须大于当前时间'));
                } else if (
                    (this.type == 0 || this.type == 1 || this.type == 8) &&
                    new Date(endTime).getTime() - new Date(startTime).getTime() >
                        7 * 24 * 60 * 60 * 1000
                ) {
                    callback(new Error('最长时间间隔为一周'));
                } else if (
                    new Date(endTime).getTime() - new Date(startTime).getTime() <
                    60 * 60 * 1000
                ) {
                    callback(new Error('起止时间最小间隔一个小时'));
                } else {
                    callback();
                }
            } else {
                callback();
            }
        };
        const validateTime = (rule, value, callback, cur) => {
            //验证警戒值\
            let _this = this;
            let [startTime,endTime] = value || [];
            let [sceneStartTime,sceneEndTime] = _this.formValidate.Dates;
            if (!startTime || !endTime) {
                callback(new Error('请选择时间'));
            }  else if (value.length > 0) {
                let attackTimeframe = [..._this.formValidate.attackTimeframe];
                let defendTimeframe = [..._this.formValidate.defendTimeframe]
                if(cur.type === 'attack'){
                    attackTimeframe.splice(cur.index,1)
                }else if(cur.type === 'defend'){
                    defendTimeframe.splice(cur.index,1)
                }
                let times = [...attackTimeframe,...defendTimeframe]
                let hasConflict = times.some(time => {
                    return new Date(startTime).getTime() < new Date(time.time[1]).getTime() && new Date(endTime).getTime() > new Date(time.time[0]).getTime()
                });
                if(new Date(startTime).getTime() < new Date(sceneStartTime).getTime()) {
                    callback(new Error('开始时间不能小于比赛开始时间'));
                } else if (new Date(endTime).getTime() > new Date(sceneEndTime).getTime()) {
                    callback(new Error('结束时间不能大于比赛结束时间'));
                }else if (startTime === endTime) {
                    callback(new Error('结束时间不能等于开始时间'));
                }else if (hasConflict) {
                    callback(new Error('时段时间冲突'));
                } else {
                    callback();
                }
            } else {
                callback();
            }
        };
        return {
            createProModal:false,
            validateTime,
            nameErrorTip,
            isDistributedChoose: false,
            prjType: '',
            DistributedDesigner: {},
            DistributedCompanyName: '',
            companyName: '',
            stMode: false,
            loadingTable: true, // 加载表单中
            reconstruction: false,
            reconstructionText: '',
            reconstructionTitle: '',
            hasProject: false,
            USER_ID: September.userId,
            isRootDesigner: September.isRootDesigner,
            projectid: '',
            isNeedPrj: true,
            currentPage: 1,
            showTip: false,
            uploaderror: false,
            prjlists: [],
            testList: [], //工程下的场景列表
            totalCount: 0,
            sceneList: [], //演练场景列表
            querySceneInfo: {
                pageIndex: 1,
                pageSize: 10,
                type: 0,
                order: 'desc',
                sortBy: 'createTime',
                progress: 'all',
            },
            sceneModal: {
                show: false,
                title: '创建场景',
                loading: true,
                type: 1,
                width: 700,
                tabName: 'custom', //自定义创建
            },
            formValidate: {
                high: 5,
                middle: 3,
                low: 1,
                networkModel: 'lan', // 默认内网
                createType: '1',
                cycleTime: this.type == 8 ? 20 : 5,
                description: '',
                endTime: '',
                extension: '',
                iconPath: '',
                id: '',
                name: '',
                progress: 0, // 0.准备中、1.准备完毕、2.开始中、3.裁判评判阶段、4.结束、5.暂停、6.删除中、7.删除失败
                projectId: '',
                projectName: '',
                startTime: '',
                status: 1, //0 ：不启用 1：启用
                type: 0, //0.对抗演练、1.攻防赛、2夺旗赛、3知识赛、4渗透演练
                Dates: [],
                stMode: 0,
                scoreMode: 0,
                wpUpMode: 1,
                isDistributed: 0,
                hlConfig: 0, //新对抗
                isMainRange: 1,
                targetScore: 5000,
                cycleScore: this.type == 8 || this.hlConfig == 2 ? 100 : 10,
                basicScore: 5000,
                enResetNum: 3,
                resetLostScore: 100,
                onlineMode: (this.type==5&&this.extension==1)?1:0,
                outsideGatewayIP: '', //网关ip
                outsideIP: '', //外网ip
                isBlindPlay: 0,
                touchType: 1,
                deployMode: 2,
                hwChangeIp: '0',
                isBasicScore: 0,
                oneScore: 100,
                basicDeduction: 10,
                isExtraCredit: 0,
                isSupergroup: 0,
                isAllowApplicationPrompt: this.type !== 8 ? 1 : 0,
                ExtraCreditValue1: 6,
                ExtraCreditValue2: 4,
                ExtraCreditValue3: 2,
                ExtraCreditValue4: 1,
                ExtraCredit1: 1,
                ExtraCredit2: 1,
                ExtraCredit3: 1,
                ctfDeduction: 20,
                accessGroupUsers: [],
                scoringType:1 ,//新护网计分方式，是否按中山护网计算
                typeIp:'1211',
                teamIpCount:2,
                publicSubnetId:'',
                questionMinScore:300,  //每题最低分数
                questionAllowDefendCount:10, //每题允许提交防御次数
                submitTime:1, //多长时间
                submitCount:1, //提交多少次
                attackTimeframe:[{time:[]}], //攻击时段
                defendTimeframe:[{time:[]}], //防守时段
                curveDecelerateRate:5,
                envType:1,
                testType:'',
                testProduct:'',
                // endClearConfig:0
            },
            ruleValidate: {
                teamIpCount:[ 
                     { validator: validateIsNumber, trigger: 'change',required: true },
                    ],
                createType: [{ required: true, message: '不能为空', trigger: 'change, blur' }],
                id: [{ required: true, message: '不能为空', trigger: 'change, blur' }],
                name: [
                    { required: true, message: '不能为空', trigger: 'change, blur' },
                    { validator: validateName128, trigger: 'change, blur' },
                ],
                projectId: [{ required: this.type === 17 ? false : true, message: '不能为空', trigger: 'change, blur' }],
                progress: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                ],
                type: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                ],
                Dates: [
                    { required: true, type: 'array', message: '不能为空', trigger: 'change, blur' },
                    { validator: validateDate, trigger: 'change, blur' },
                ],
                cycleTime: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                    { validator: validateNum, trigger: 'change, blur' },
                ],
                cycleScore: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                    { validator: validateNum1000, trigger: 'change, blur' },
                ],
                basicScore: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                    { validator: validateNum100000, trigger: 'change, blur' },
                ],
                enResetNum: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                    { validator: validateNum10, trigger: 'change, blur' },
                ],
                resetLostScore: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                    { validator: validateNum1000, trigger: 'change, blur' },
                ],
                stMode: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                ],
                scoreMode: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                ],
                wpUpMode: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                ],
                isDistributed: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                ],
                isMainRange: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                ],
                targetScore: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                    { validator: validateNum100000, trigger: 'change, blur' },
                ],
                high: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                    { validator: validateNum, trigger: 'change, blur' },
                ],
                middle: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                    { validator: validateNum, trigger: 'change, blur' },
                ],
                low: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                    { validator: validateNum, trigger: 'change, blur' },
                ],
                onlineMode: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                ],
                networkModel: [
                    {
                        required: true,
                        type: 'string',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                ],
                isBlindPlay: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                ],
                touchType: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                ],
                deployMode: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                ],
                hwChangeIp: [{ required: true, message: '不能为空', trigger: 'change, blur' }],
                typeIp: [{ required: true, message: '不能为空', trigger: 'change, blur' }],
                isBasicScore: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                ],
                oneScore: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                    { validator: validateNum, trigger: 'change, blur' },
                ],
                basicDeduction: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                    { validator: validateNum, trigger: 'change, blur' },
                ],
                isExtraCredit: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                ],
                isSupergroup: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                ],
                isAllowApplicationPrompt: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                ],
                outsideGatewayIP: [
                    { required: true, message: '不能为空', trigger: 'change, blur' },
                ],
                ExtraCreditValue1: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                    { validator: validateNum, trigger: 'change, blur' },
                ],
                ExtraCreditValue2: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                    { validator: validateNum, trigger: 'change, blur' },
                ],
                ExtraCreditValue3: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                    { validator: validateNum, trigger: 'change, blur' },
                ],
                ExtraCreditValue4: [
                    { required: true, type: 'number', message: '不能为空', trigger: 'change' },
                    { validator: validateNum, trigger: 'change' },
                ],
                publicSubnetId : [{ required: true,type:'string', message: '不能为空', trigger: 'blur' }],
                ExtraCredit1: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                    { validator: validateNum, trigger: 'change, blur' },
                ],
                ExtraCredit2: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                    { validator: validateNum, trigger: 'change, blur' },
                ],
                ExtraCredit3: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                    { validator: validateNum, trigger: 'change, blur' },
                ],
                ctfDeduction: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                    { validator: validateNum, trigger: 'change, blur' },
                ],
                accessGroupUsers: [
                    {
                        required: true,
                        type: 'array',
                        trigger: 'change',
                        validator: (rule, value, callback) => {
                            return validateTeam(rule, this.formValidate.accessGroupUsers, callback);
                        },
                    },
                ],
                scoringType: [
                    {
                        required: true,
                        type: 'number',
                        message: '不能为空',
                        trigger: 'change, blur',
                    },
                ],
                questionMinScore:[
                    {
                        required: true,
                        type: 'number',
                        trigger: 'change, blur',
                        validator: getNumReg()
                    },
                ],
                questionAllowDefendCount:[
                    {
                        required: true,
                        type: 'number',
                        trigger: 'change, blur',
                        validator: getNumReg()
                    },
                ],
                submitTime:[
                    {
                        required: true,
                        type: 'number',
                        trigger: 'change, blur',
                        validator: getNumReg()
                    },
                ],
                attackTimeframe:[
                    {
                        required: true,
                        type: 'array',
                        min:1,
                        max:1,
                        message: '不能为空',
                        trigger: 'change, blur',
                        defaultField:[{
                            validator:validateTime
                        }]
                    },
                ],
                defendTimeFrame:[
                    {
                        required: true,
                        type: 'array',
                        min:1,
                        max:1,
                        message: '不能为空',
                        trigger: 'change, blur'
                    },
                ],
                curveDecelerateRate:[
                    {
                        required: true,
                        type: 'number',
                        trigger: 'change, blur',
                        validator: getNumReg()
                    }
                ],
                envType:{
                    required: true,
                    type: 'number',
                    message: '不能为空',
                    trigger: 'change, blur',
                },
                testType:{
                    required: true,
                    type: 'number',
                    message: '不能为空',
                    trigger: 'change, blur',
                },
                // endClearConfig:{
                //     required: true,
                //     type: 'number',
                //     message: '不能为空',
                //     trigger: 'change, blur',
                // }
            },
            uploadAction: '/api/minio/upload/permanent?visibility=company&type=images&bucket=images', //"/api/ftp/edu-ftp/upload/" +  September.userId,
            uploadHeader: {
                Authorization: localStorage.token,
                Accept: '*/*',
            },
            vertical: '',
            item: {},
            iconSrc: '',
            sceneType: '', //没用了
            disabledOptions: {
                disabledDate(date) {
                    return date && date.valueOf() < Date.now() - 86400000;
                },
            },
            publicSubnets: [],
            createByMe: false,
            showExtraCredit: false,
            //删除工程modal
            delDrillModal: false,
            enableDelProject: 0,
            delLoophole: 0,
            delModalLoading: false,
            // 生成模板modal
            generateTemplateModal: {
                show: false,
                sceneId: '',
            },
            competeSysSubnetsID:'',
            showCtfEnvType:false,
            showModal:false, // 月数据分析
            projectInfoModal:false, // 项目信息
            projectInfo:{}, // 项目信息
            statisticsIndustryModal:false,// 23210 攻击方报告的审核结果，按照目标单位的行业分布及严重程度进行状图展示；
            echartIndustryData:[],
            industryStatisticsInfo:{},
          
            vulneraStatisticsModal:false, // 漏洞统计信息
            vulneraStatisticsInfo:{}, // 漏洞统计信息
            resultInfoModal:false, // 漏洞结果
            resultInfo:{}, // 漏洞结果信息
            resultTotal: 0, // 漏洞结果信息
            resultPageSize: 10, // 分页大小
            resultPageIndex: 1, // 当前页
            resultColumns:[
              {
                placement: "top-left",
                title: "目标",
                key: "targetName",
                // align: "center",
                tooltip: true,
                // minWidth: 150,
              },
              {
                title: "漏洞名称",
                width: 150,
                key: "name",
                tooltip: true,
              },
              {
                title: "漏洞评级",
                width: 150,
                key: "level",
                tooltip: true,
                render: (h, params) => {
                  let obj = this.mixinLevel(params.row.level)
                  return h('Tag', {
                    props: {
                      color: obj.color
                    },
                    style: {
                      width: '70px',
                      'text-align': 'center'
                    }
                  }, obj.text)
                }
              },
              {
                title: "漏洞评分",
                width: 100,
                key: "value",
                tooltip: true,
              },
              {
                title: '漏洞类型',
                key: 'type',
                // show:false,
                tooltip: true,
              },
              {
                title: '地址',
                key: 'url',
                show:false,
                tooltip: true,
              },
              {
                title: "状态",
                width: 100,
                key: "status",
                tooltip: true,
                render: (h, params) => {
                  let color = '';
                  let text = '';
                  let status = params.row.status ? params.row.status : 1;
                  if (status == 3) {
                    color = 'success';
                    text = '已修复';
                  } else if (status == 2) {
                    color = 'success';
                    text = '已复测';
                  } else if (status == 1) {
                    color = 'error';
                    text = '发现';
                  } else if (status == 4) {
                    color = 'default';
                    text = '确认修复';
                  }
                  return h('span', [
                    h(
                      'Tag',
                      {
                        props: {
                          color: color
                        }
                      },
                      text
                    )
                  ]);
                }
              },
              {
                title: "描述",
                minWidth: 150,
                key: "description",
                tooltip: true,
              },
              {
                title: "创建时间",
                minWidth: 150,
                key: "created",
                tooltip: true,
              }
            ],
            resultDataList:[],
            productList:[] //资产信息列表
        };
    },
    watch: {
        type(val){
            this.getSceneList()
        },
        templateAccessGroupList: {
            handler(val, oldVal) {
                this.formValidate.accessGroupUsers = val.map((item) => {
                    return {
                        id: item.id,
                        testId: item.testId,
                        userIds: item.userList.map((user) => user.userId),
                        userCount: item.userCount,
                    };
                });
                if (
                    this.sceneModal.tabName === 'template' &&
                    this.$refs['formValidate'].fields.find(
                        (field) => field.prop === 'accessGroupUsers'
                    )
                ) {
                    this.$refs['formValidate'].validateField('accessGroupUsers', (valid) => {});
                }
            },
            deep: true,
        },
        'formValidate.typeIp':{
            immediate: true,
            handler(newVal,oldVal){
                if(newVal=='1211' && this.extension==1){
                this.ruleValidate.publicSubnetId = [{ required: true,type:'array', message: '不能为空', trigger: 'blur' }]  
                // this.formValidate.publicSubnetId = []
                }else{
                    this.ruleValidate.publicSubnetId = [{ required: true,type:'string', message: '不能为空', trigger: 'blur' }]    
                    // this.formValidate.publicSubnetId = ''
                }
            }
        },
        // 'formValidate.Dates':{
        //     handler(newVal,oldVal){
        //         debugger
        //         if(oldVal.length !== 0){
        //             this.formValidate.attackTimeframe = [{time:[]}];
        //             this.formValidate.defendTimeframe = [{time:[]}];
        //         }
        //     }
        // }
        // extension:{
        //     immediate: true,
        //      handler(val, oldVal) {
        //         if(val==2){
        //             this.ruleValidate.publicSubnetId = [{ required: true,type:'string', message: '不能为空', trigger: 'blur' }] 
        //         }
        //      }
            
        // }
    },
    filters: {},
    computed: {
         ...mapGetters(['showAsset']),
        ...mapState('style', {
          defaultColor: ({ themeConfig }) => {
            return themeConfig.defaultColor;
          },
        }),
        // 是否属于攻防赛、渗透演练、护网演练，这三种类型使用的是场景而非工程（不再有竞赛、演练类型使用场景工程）
        showScene() {
            return [].includes(this.type);
        },
        title() {
            return this.$store.getters.pageTitle;
        },
        disableTimeframedOptions(){
            let [startTime,endTime] = this.formValidate.Dates;
            if(!startTime || !endTime){
                return {}
            }
            return {
                disabledDate(date) {
                    return date && (date.valueOf() > new Date(endTime.split(' ')[0] + ' 23:59:59').getTime() || date.valueOf() < new Date(startTime.split(' ')[0]+' 00:00:00').getTime())
                }
            }
        },
        showDelLoophole(){
            // extension 1新护网 2众测演练 4 仿真 3 日常
            return this.type == 5 && [1,2,4].includes(this.extension)
        }
    },
    mounted() {
        if (this.type == 0 || this.type == 7) {
            this.isDistributedChoose = true;
        } else {
            this.isDistributedChoose = false;
        }
        // this.setStyle(); // 计算分页大小后，获取场景列表
        // window.addEventListener('resize', this.setStyle);
        this.formValidate.type = this.type;
        this.querySceneInfo.type = this.type;
        let sType = this.type + '';
        this.isNeedPrj = sType !== '2';
        this.sceneType = this.typeFilter(this.type); //没用了
        //赋值查询条件
        let queryObj = sessionStorage.getItem('queryObj');
        if (queryObj) {
            let params = JSON.parse(queryObj);
            this.createByMe = params.creator == this.USER_ID;
            this.querySceneInfo = params;
            sessionStorage.removeItem('queryObj');
        }
        // if (this.type == 7) {
        //     this.formValidate.stMode = 1;
        // }
        this.queryDistributed();
        let November = sessionStorage.getItem('November');
        November = JSON.parse(encryption.SelfUseDecrypt(November));
        this.companyName = November.companyName;
        this.queryPublicSubnets();
        this.getSceneList();
        if(this.type === 17){
            this.getProductList() //资产
        }
    },
    beforeDestroy() {
        clearTimeout(this.refreshTimer);
        clearTimeout(this.timer);
        // window.removeEventListener('resize', this.setStyle);
    },
    methods: {

      // type ----{{type}}---extension—{{extension}}
      //
      // <!--
      // type: 
      // 0 对抗演练
      // 4：渗透演练
      // 5：护网演练 日常渗透 仿真对抗  众测演练 实网测试
      // 10：应急演练
      // 7：综合演练
      // 2：夺旗赛
      // 1： 攻防赛
      // 8：AWDP
      // 9：运维赛
      //
      //
      // extension 3日常渗透  0 护网   4：仿真对抗 2：众测演练  1：实网测试
      // 无： 渗透演练  对抗演练 综合演练 应急演练 夺旗赛 攻防赛 AWDP 运维赛
      //
      //
      // -->
      
      
        getStitle(){// 获取两个字的小标题
          // extension = 4：仿真对抗 2：众测演练  1：实网测试
          let extension = this.extension
          if([1, 2, 4].includes(extension) || this.type === 17){
            return '测试'
          }
          //  :placeholder="`${[1, 2, 8, 9].includes(type) ? '竞赛' : '演练'}进度`"
          let type = this.type
          if([1, 2, 8, 9].includes(type)){
            return '竞赛'
          }
          if(type == 18){
            return '练习'
          }
          return '演练'
        },
        // 危险等级
        mixinLevel(val) {
          switch(val) {
            case '0': return { text: '高危', color: '#ed4014' }
            case '1': return { text: '中危', color: '#ff9900' }
            case '2' || '3': return { text: '低危', color: '#2db7f5' }
            default: return { text: '未定级', color: '' }
          }
        },
        // 点击项目信息
        getProjectInfo(row){
            let name = JSON.parse(JSON.stringify(row.name))
            this.projectInfoModal = true
           getFZInformation(row.id).then(res=>{
            if(res.code ==1){
                this.projectInfo = res.data
            }else{
                this.projectInfo = {}
                this.$Message.warning(res.message)
            }
            this.projectInfo.secenName = name
           }).catch(error=>{
                this.projectInfo = {}
                this.$Message.error(error)
           })
        },
        // 23210 实网演练，需要支持根据攻击方报告的审核结果，按照目标单位的行业分布及严重程度进行状图展示；
        getAttackResult(row){
          this.echartIndustryData = []
          this.statisticsIndustryModal = true
          this.industryStatisticsInfo = row
          let _this = this
          
          
          reportStatisticIndustry(row.id).then(res => {
       
            if(res.data && res.data.code ==1){
              let echartIndustryData = res.data.data||[]
              // console.log('---this.echartIndustryData---',echartIndustryData,echartIndustryData.length)
              document.getElementById('industrychart').innerHTML = '';
              setTimeout(()=>{
                getDirectionForSelect('hwIndustryTypes').then(dicts=>{
                  // [{label: '党政机关', value: 'hwIndustryType1'}]
                  let dictmap ={}
                  dicts.forEach(dict=>{
                    dictmap[dict.value] = dict.label
                  })
                  //console.log('---hwIndustryTypes护网行业的字典------',dictmap)
                  
                  _this.initEchartIndustry(echartIndustryData,dictmap)
                })
                
              },300)
              
            }else{
              this.echartIndustryData =[] 
            }
         
          }).catch(error=>{
            // this.echartIndustryData =[]
            this.$Message.error(error)
          }).finally(()=>{
          
          })
        },
        initEchartIndustry(echartIndustryData,dictmap){ //industrychart
       
          //  data = [
          //   { level: 'Apple', type: '整体', value: 30 },
          //   { level: 'Facebook', type: '整体', value: 35 },
          //   { level: 'Google', type: '整体', value: 28 },
          //   { level: 'Apple', type: '非技术岗', value: 40 },
          //   { level: 'Facebook', type: '非技术岗', value: 65 },
          //   { level: 'Google', type: '非技术岗', value: 47 },
          // ];

           let map={
             high:'高',
             middle:'中',
             low:'低',
           }
          
          let data2 = []
          let maxvalue = 0
          echartIndustryData.forEach(item1=>{
            if(item1 && item1.industry){
              let industry = item1.industry
              let levelCountList = item1.levelCountList||[]
              
              let levelcount = {
                high:0,
                middle:0,
                low:0,
              }
              levelCountList.forEach(item2=>{
                if(item2.count > maxvalue) maxvalue = item2.count
                data2.push( { level:  map[item2.level], type:dictmap[industry]||'未知行业', value: item2.count })
                levelcount[item2.level] = levelcount[item2.level]+1
              })

              levelcount.high===0 && data2.push( { level: map['high'], type:dictmap[industry]||'未知行业', value: 0 })
              levelcount.middle===0 && data2.push( { level:  map['middle'], type:dictmap[industry]||'未知行业', value: 0 })
              levelcount.low===0 && data2.push( { level:  map['low'], type:dictmap[industry]||'未知行业', value: 0 })
            }
          })
          console.log('攻击目标单位echat-----',echartIndustryData,data2)
          
          this.echartIndustryData = data2

          
          const chart = new G2.Chart({
            container: 'industrychart',
            forceFit: true,
            height: 400,
            padding: [60,60,60,80]
          });
          chart.source(data2);
          chart.scale('value', {
            alias: '数量',
            max: Math.round(maxvalue+1),
          });
          chart.axis('type', {
            label: {
              textStyle: {
                fill: this.defaultColor
              }
            },
          });
         

          chart.axis('value', {
            title: {
              style: {
                fontSize: 12,
                fill: this.defaultColor,
                x: 50, // 如果不设置 x y 的值，则 title 居中显示
              },
            },
          });
          // chart.legend(false);
          chart.tooltip(true);
          
          chart.legend({
            position: 'bottom-center'
          });
          chart.interval().position('type*value').color('level')
          .opacity(1)
          .adjust([{
            type: 'dodge',
            marginRatio: 0.15 //// 设置柱子的间距
          }]
          );
          chart.render();
        },
      
        // 点击漏洞统计
        getVulneraStatistics(row){
            this.vulneraStatisticsModal = true
            let name = JSON.parse(JSON.stringify(row.name))
            let params = {
                contestId:row.id,
                projectId:row.projectId
            }
           getVulLevel4ContestNum(params).then(res=>{
            if(res.code ==1){
                this.vulneraStatisticsInfo = res.data
            }else{
                this.vulneraStatisticsInfo = {}
                this.$Message.warning(res.message)
            }
            this.vulneraStatisticsInfo.name = name
           }).catch(error=>{
                this.vulneraStatisticsInfo = {}
                this.$Message.error(error)
           })
        },
        // 点击漏洞结果
        getResultInfo(row){
            this.resultInfo = JSON.parse(JSON.stringify(row)) 
            // this.getResultList()
            this.resultInfoModal = true
        },
        getResultList(){
            let params = {  
               pageIndex:this.resultPageIndex,
               pageSize:this.resultPageSize,
               contestId: this.resultInfo.id,
             }
             getVul4ContestPage(params).then(data=>{
                 if(data.code==1){
                     this.resultDataList = data.data.items
                     this.resultTotal = data.data.total
                 }else{
                    this.resultDataList = []
                     this.resultTotal = 0
                     this.$Message.warning(res.message)
                 }
             }).catch(error=>{
                console.log(error);
             })
        },
        // 点击
        showMonthlyAnalysis(){
            this.showModal = true
        },
        // 关闭
        colseVisibleChange(val){
            if(!val){
                this.showModal= false
            }
        },
        addTimeFrame(type){
            this.formValidate[`${type}Timeframe`].push({time:[]})
        },  
        removeTimeFrame(type,index){
            this.formValidate[`${type}Timeframe`].splice(index,1)
            this.validateConfigTimes('',type);
        },
        changeTimeframe(time,item,type){
            // let [startTime,endTime] = time;
            // if(startTime && endTime){
            //     let [sceneStartTime,sceneEndTime] = this.formValidate.Dates;
            //     if(new Date(startTime).getTime() < new Date(sceneStartTime).getTime()){
            //         startTime = sceneStartTime
            //     }
            //     if(new Date(endTime).getTime() > new Date(sceneEndTime).getTime()){
            //         endTime = sceneEndTime
            //     }
            //     item.time = [`${startTime}:00`,`${endTime}:00`]
            // }else{
            //     item.time = []
            // }
            this.validateConfigTimes(item.index,type);
        },
        validateConfigTimes(cindex,type) {
            this.formValidate.attackTimeframe.forEach((time,index) => {
                if((type === 'attack' && cindex === index) || time.time.length == 0 || !time.time[0]){
                    return 
                }
                this.$refs['formValidate'].validateField(`attackTimeframe.${index}.time`, (error) => {
                    // resolve(error);
                });
            })
            this.formValidate.defendTimeframe.forEach((time,index) => {
                if((type === 'defend' && cindex === index) || time.time.length == 0 || !time.time[0]){
                    return 
                }
                this.$refs['formValidate'].validateField(`defendTimeframe.${index}.time`, (error) => {
                    // resolve(error);
                });
            })
        },
        handleChangeDates(time){
            // ...args
            // this.formValidate.attackTimeframe = [{time:[]}];
            // this.formValidate.defendTimeframe = [{time:[]}];
            // let [startTime,endTime] = timeList;
            // if(new Date(startTime).getTime() < this.currentTime){
            //     startTime = this.timestampToTime(new Date().getTime()) // + 60 * 60 * 1000
            // }
            // if(new Date(endTime).getTime() < this.currentTime){
            //     endTime = this.timestampToTime(new Date().getTime() + 60 * 120 * 1000)
            // }
            // if(startTime && endTime){
            //     this.formValidate.Dates = [`${startTime}:00`,`${endTime}:00`]
            // }else{
            //     this.formValidate.Dates = []
            // }
            // this.formValidate.Dates = timeList
            // this.changeDates(...args)
            if(time){
                this.formValidate.startTime = time[0];
                this.formValidate.endTime = time[1];
            }else{
                this.formValidate.startTime = '';
                this.formValidate.endTime = '';
            }
            if(this.type == 8 && this.formValidate.scoringType == 1){
                this.validateConfigTimes();
            }
        },
        changeTab(name) {
            // this.initData();
            this.$refs.formValidate.resetFields();
            // 默认创建延迟三分钟开始，时长一小时的竞赛/演练
            this.formValidate.Dates = [
                this.timestampToTime(new Date().getTime() + 60 * 60 * 1000),
                this.timestampToTime(new Date().getTime() + 60 * 120 * 1000),
            ];
            this.timeChange(this.formValidate.Dates);
            this.iconPath = '';
            this.showExtraCredit = false;
            this.showTip = false;
            this.sceneModal.tabName = name;
            this.templateList = [];
            this.templateAccessGroupList = [];
            if (this.sceneModal.tabName === 'template' && this.templateList.length === 0) {
                this.getSceneTemplateList(this.type);
            }
        },
        queryDistributed() {
            queryDistributed()
                .then((res) => {
                    if (res.data.code == 1) {
                        this.DistributedDesigner = res.data.data;
                        this.DistributedCompanyName = this.DistributedDesigner.companyName;
                    } else {
                        this.DistributedCompanyName = '';
                    }
                })
                .catch((err) => {
                    console.log(err);
                });
        },
        isDistributedDesigner() {
            if (this.DistributedCompanyName == '') {
                return false;
            }
            return this.DistributedCompanyName != this.companyName;
        },
        changeIsDistributed(val) {
            if (val == 1) {
                this.formValidate.stMode = 0;
                console.log(val, 111111111);
                this.stMode = true;
            } else {
                this.stMode = false;
            }
        },
        // 通过屏幕可显示高度，计算能展示多少条记录，最少需要展示一条
        setStyle() {
            clearTimeout(this.refreshTimer);
            this.refreshTimer = setTimeout(() => {
                window.fullHeight = document.documentElement.clientHeight;
                window.fullWidth = document.documentElement.clientWidth;
                this.fullHeight = window.fullHeight;
                this.fullWidth = window.fullWidth;
                this.setTableHei = this.fullHeight - 197;
                this.querySceneInfo.pageSize = Math.floor(this.setTableHei / 96) || 1;
                this.querySceneInfo.pageIndex = 1;
                this.getSceneList();
            }, 200);
        },
        // 转义竞赛、演练的数字状态码为对应中文内容
        typeFilter(val) {
            // 0.对抗演练、1.攻防赛、2夺旗赛、3知识赛、4渗透演练
            switch (val) {
                case 0:
                    return '对抗演练';
                case 1:
                    return '攻防赛';
                case 2:
                    return '夺旗赛';
                case 3:
                    return '知识赛';
                case 4:
                    return '渗透演练';
                case 7:
                    return '综合演练';
                case 5:
                    return '护网演练';
                case 8:
                    return '攻防赛Plus';
                case 9:
                    return '运维赛';
                case 10:
                    return '应急防御演练';
                default:
                    return '';
            }
        },
        // 获取工程列表
        getPrjList() {
            if (this.showScene) {
                // 属于攻防赛、渗透演练、护网演练时，需要的是获取场景列表
                this.getSceneProject();
                return;
            }
            let params = {};
            params.pageIndex = 1;
            params.pageSize = 2147483647;
            if(this.type !== 17){
                params.status = 3;
            }
            if (this.isRootDesigner) {
                params.enableAll = true;
            }
            getProjects(params).then((data) => {
                if (data.code == 1) {
                    this.prjlists = data.data.items;
                } else {
                    this.$Message.error(data.message);
                }
            });
        },
        //获取场景工程
        getSceneProject() {
            let params = {
                page: 1,
                pageSize: 2147483647,
                type: this.filterSceneType(this.type),
                status: 3,
            };
            getSceneProject(params).then((data) => {
                if (data.code == 1) {
                    this.prjlists = data.data.items;
                } else {
                    this.$Message.error(data.message);
                }
            });
        },
        // 转义场景类型
        filterSceneType(type) {
            switch (type) {
                case 0:
                    return 'red_and_blue_confrontation';
                case 1:
                    return 'offense_and_defense';
                case 8:
                    return 'offense_and_defense_plus';
                case 2:
                    return 'capture_the_flag';
                case 4:
                    return 'break_through';
                case 5:
                    if(this.extension == 4){
                        return 'simulation_network_exercise';
                    }else{
                        return 'protect_network_exercise';
                    }
                case 7:
                    return 'multiple';
                case 9:
                    return 'operation_and_maintenance';
                case 10:
                    return 'emergency_defense_drill';
                default:
                    return 'other';
            }
        },
        // 查询工程对应的工程场景
        getPrjSceneList(projectId) {
            if (projectId) {
                let params = {
                    pageIndex: 1,
                    pageSize: 2147483647,
                    projectId: projectId,
                };
                let type = this.filterSceneType(this.type);
                getTests(params).then((data) => {
                    // 过滤掉不同类型并且不可用的场景
                    this.testList = data.data.items.filter(
                        (item) => item.type == type && item.enabled
                    );
                    // 对抗演练、综合演练名称已经设置过，这里不再设置
                    if (this.testList.length > 0) {
                        this.formValidate.id = this.testList[0].id;
                        if (this.sceneModal.type == '1' && ![0, 7, 10].includes(this.type)) {
                            // 创建时需要设置名字，修改时不允许修改工程，所以名称也不需要修改
                            // 创建非对抗演练、综合演练的演练、竞赛时，设置场景名称为自己的名称
                            this.formValidate.name = this.testList[0].name;
                        }
                    } else {
                        this.formValidate.id = '';
                        if (![0, 7, 10].includes(this.type)) {
                            this.formValidate.name = '';
                        }
                    }
                });
            }
        },
        // 刷新操作，清空搜索条件并重新获取数据
        refreshSceneList() {
            this.querySceneInfo = Object.assign(this.querySceneInfo, {
                pageIndex: 1,
                order: 'desc',
                sortBy: 'createTime',
                progress: 'all',
                name: '',
                testType:'',
                type: this.type,
            });
            this.createByMe = false;
            this.getSceneList();
        },
        // 获取演练、竞赛列表数据
        getSceneList() {
            if(!this.type && this.type !== 0){
                return
            }
            // this.loadingTable = true;
            this.$nextTick(() => {
                let params = JSON.parse(JSON.stringify(this.querySceneInfo));
                params.progress = params.progress == 'all' ? '' : params.progress;
                params.creator = this.createByMe ? this.USER_ID : '';
                params.pageSize = params.pageSize ? params.pageSize : 1;
                if(this.type === 17){
                    params.extension = params.testType;
                    delete params.testType
                }else {
                    params.extension = this.extension === 0 ? 0 : this.extension == 2 ? 2 : 1;
                }
                if(this.extension == 2) {
                    params.vpn = true
                }
                if(this.type == 5 && this.extension == 3 ) {
                    // 日常渗透
                    params.hwExtentionType = 2
                    delete params.extension
                }
                if(this.type == 5 && this.extension == 4){
                    // 仿真
                    params.extension = 3
                }
                this.queryObj = JSON.stringify(params);
                getSceneList(params)
                    .then((data) => {
                        if (data.code == 1) {
                            let sType = this.type + '';
                            if (sType === '2') {
                                // 夺旗赛需要补充归档状态、归档进度、快速部署的创建进度
                                let handleData = data.data.items.map(async (item) => {
                                    item.isSending = false;
                                    item.quickSend = false;
                                    try {
                                        //查询归档状态
                                        let status = await this.getFilingStatus(item);
                                        item.filingStatus = status;
                                        if (status && item.projectId) {
                                            let progress = await this.getCopyProgress(item);
                                            item.filingProgress = progress;
                                        } else {
                                            item.filingProgress = '无进度';
                                        }
                                        let extension = parseJson(item.extension);
                                        if (extension.deploymentType) {
                                            // 查询分批部署进度
                                            await getBatchDeployProgress(item.projectId)
                                                .then((data) => {
                                                    if (data.code === 1) {
                                                        // 将部署状态替换为分批部署接口返回的实际值
                                                        if (data.data) {
                                                            item.quickCreateStatus =
                                                                data.data.status;
                                                        } else {
                                                            item.quickCreateStatus = 'queryError';
                                                        }
                                                    } else {
                                                        item.quickCreateStatus = 'queryError';
                                                    }
                                                })
                                                .catch((error) => {
                                                    item.deployStatus = 'queryError';
                                                })
                                                .finally(() => {
                                                    item.isBatchDeployment = true;
                                                });
                                        } else {
                                            // 快速构建，查询快速构建接口进度
                                            await quickCreateProgress(item.id).then((data) => {
                                                if (data.code === 1) {
                                                    if (data.data) {
                                                        let progress = data.data.deployProgress;
                                                        item.quickCreateProgress = progress;
                                                        item.quickCreateStatus =
                                                            data.data.deployStatus;
                                                        let paramJson = parseJson(
                                                            data.data.paramJson
                                                        );
                                                        let deployCheckStatus =
                                                            paramJson.deployCheckStatus;
                                                        // 校验失败
                                                        if (
                                                            deployCheckStatus !== undefined &&
                                                            deployCheckStatus !== 1
                                                        ) {
                                                            item.verifyError = true;
                                                        }
                                                        let environInfo = JSON.parse(
                                                            data.data.paramJson
                                                        );
                                                        this.$set(
                                                            item,
                                                            'outsideIP',
                                                            environInfo.outsideIP
                                                        );
                                                    } else {
                                                        item.quickCreateProgress = -100;
                                                        item.quickCreateStatus = null;
                                                    }
                                                }
                                            });
                                        }
                                        if (item.projectId) {
                                            let status = await this.getProjectDetails(
                                                item.projectId
                                            );
                                            if (status === 1) {
                                                this.$set(item, 'available', true);
                                            }
                                        }
                                        if (
                                            (item.deployStatus == 17 || item.deployStatus == 6) &&
                                            item.projectId
                                        ) {
                                            let {
                                                data: { items },
                                            } = await getProjects({ id: item.projectId }).catch(
                                                (error) => console.log(error)
                                            );
                                            if (items.length > 0) {
                                                this.$set(
                                                    item,
                                                    'errorMessage',
                                                    items[0].errorMessage
                                                );
                                            } else {
                                                this.$set(
                                                    item,
                                                    'errorMessage',
                                                    '无法获取到错误信息'
                                                );
                                            }
                                        }
                                    } catch (err) {
                                        item.quickCreateProgress = -100;
                                        item.quickCreateStatus = null;
                                    }
                                    return item;
                                });
                                Promise.all(handleData)
                                    .then((res) => {
                                        this.sceneList = res;
                                    })
                                    .catch(() => {
                                        this.sceneList = data.data.items;
                                    })
                                    .finally(() => {
                                        this.totalCount = data.data.total;
                                        this.loadingTable = false;
                                    });
                            } else {
                                // 对抗演练、攻防赛需要补充周期数、归档状态、归档进度
                                if (this.type == 0 || this.type == 1 || this.type == 8) {
                                    let pArr = data.data.items.map(async (item) => {
                                        try {
                                            //查询周期数
                                            await getSceneCycleNum(item.id).then((data) => {
                                                if (data.code === 1) {
                                                    if (data.data) {
                                                        item.cycleNum = data.data;
                                                    } else {
                                                        item.cycleNum = 0;
                                                    }
                                                }
                                            });
                                            //查询归档状态
                                            let status = await this.getFilingStatus(item);
                                            item.filingStatus = status;
                                            if (status && item.projectId) {
                                                let progress = await this.getCopyProgress(item);
                                                item.filingProgress = progress;
                                            } else {
                                                item.filingProgress = '无进度';
                                            }
                                            if (item.projectId) {
                                                let status = await this.getProjectDetails(
                                                    item.projectId
                                                );
                                                if (status === 1) {
                                                    this.$set(item, 'available', true);
                                                }
                                            }
                                            if (
                                                (item.deployStatus == 17 ||
                                                    item.deployStatus == 6) &&
                                                item.projectId
                                            ) {
                                                let {
                                                    data: { items },
                                                } = await getProjects({ id: item.projectId }).catch(
                                                    (error) => console.log(error)
                                                );
                                                if (items.length > 0) {
                                                    this.$set(
                                                        item,
                                                        'errorMessage',
                                                        items[0].errorMessage
                                                    );
                                                } else {
                                                    this.$set(
                                                        item,
                                                        'errorMessage',
                                                        '无法获取到错误信息'
                                                    );
                                                }
                                            }
                                        } catch (err) {
                                            item.cycleNum = 0;
                                            item.filingProgress = '无进度';
                                            item.filingStatus = '未归档';
                                        }
                                        return item;
                                    });
                                    Promise.all(pArr)
                                        .then((data) => {
                                            this.sceneList = data;
                                        })
                                        .catch((error) => {
                                            this.sceneList = data.data.items;
                                        })
                                        .finally(() => {
                                            this.totalCount = data.data.total;
                                            this.loadingTable = false;
                                        });
                                } else if(this.type === 18){ //赛前练习 //实验员创建 获取题目个数和完成个数
                                        let handleData = data.data.items.map(async (item) => {
                                        let rank = await this.getCtfRank(item.id);
                                        if(rank.length > 0){
                                            this.$set(item, 'questionTotal', rank[0].finishTotal + rank[0].notFinishTotal);
                                            this.$set(item, 'finishTotal', rank[0].finishTotal);
                                            this.$set(item, 'teamId', rank[0].teamId);
                                        }else{
                                            this.$set(item, 'questionTotal', 0);
                                            this.$set(item, 'finishTotal', 0);
                                            this.$set(item, 'teamId', 0);
                                        }
                                        if (item.projectId) {
                                            let status = await this.getProjectDetails(
                                                item.projectId
                                            );
                                            if (status === 1) {
                                                this.$set(item, 'available', true);
                                            }
                                        }
                                        return item;
                                    });
                                    Promise.all(handleData)
                                        .then((res) => {
                                            this.sceneList = res;
                                        })
                                        .catch(() => {
                                            this.sceneList = data.data.items;
                                        })
                                        .finally(() => {
                                            this.totalCount = data.data.total;
                                            this.loadingTable = false;
                                        });
                                }else{
                                    // 非对抗演练、攻防赛、夺旗赛、知识赛的其他类型演练、竞赛，需要补充归档状态、归档进度
                                    let handleData = data.data.items.map(async (item) => {
                                        let status = await this.getFilingStatus(item);
                                        item.filingStatus = status;
                                        if (status && item.projectId) {
                                            let progress = await this.getCopyProgress(item);
                                            item.filingProgress = progress;
                                        } else {
                                            item.filingProgress = '无进度';
                                        }
                                        if (item.projectId) {
                                            let status = await this.getProjectDetails(
                                                item.projectId
                                            );
                                            if (status === 1) {
                                                this.$set(item, 'available', true);
                                            }
                                        }
                                        return item;
                                    });
                                    Promise.all(handleData)
                                        .then((res) => {
                                            this.sceneList = res;
                                        })
                                        .catch(() => {
                                            this.sceneList = data.data.items;
                                        })
                                        .finally(() => {
                                            this.totalCount = data.data.total;
                                            this.loadingTable = false;
                                        });
                                }
                            }
                        } else {
                            this.$Message.error(data.message);
                        }
                    })
                    .catch((err) => {
                        this.$Message.error('获取列表异常，请稍后重试');
                    })
                    .finally(() => {
                        clearTimeout(this.refreshTimer);
                        this.refreshTimer = setTimeout(() => {
                            this.getSceneList();
                        }, 10000);
                    });
            });
        },
        // 封装一层防抖方法
        changePageDebounce(page) {
            clearTimeout(this.timer);
            this.timer = setTimeout(() => {
                this.changePage(page);
            }, 200);
        },
        // 查询指定页的数据
        changePage(page) {
            this.querySceneInfo.pageIndex = page;
            this.getSceneList();
        },
        // 指定分页大小查询当前页数据
        changeSize(size) {
            this.querySceneInfo.pageSize = size;
            this.getSceneList();
        },
        // 初始化数据
        initData() {
            if (this.sceneModal.tabName === 'custom') {
                this.formValidate = {
                    high: 5,
                    middle: 3,
                    low: 1,
                    networkModel: 'lan', // 默认内网
                    createType: '1',
                    description: '',
                    endTime: '',
                    extension: '',
                    iconPath: '',
                    id: '',
                    name: '',
                    progress: 0, // 0.准备中、1.准备完毕、2.开始中、3.裁判评判阶段、4.结束、5.暂停、6.删除中、7.删除失败
                    projectId: '',
                    projectName: '',
                    startTime: '',
                    status: 1, //0 ：不启用 1：启用
                    type: this.type, //0.对抗演练、1.攻防赛、2夺旗赛、3知识赛、4渗透演练、5攻防演练
                    Dates: [],
                    cycleTime: this.type == 8 ? 20 : 5,
                    stMode: 0, // 除综合演练外其他类型默认为顺序答题
                    scoreMode: 0, //综合演练计分模式
                    isDistributed: 0,
                    hlConfig: 0,
                    isMainRange: 1,
                    wpUpMode: 1,
                    targetScore: 5000,
                    cycleScore: this.type == 8 || this.hlConfig == 2 ? 100 : 10,
                    basicScore: 5000,
                    enResetNum: 3,
                    resetLostScore: 100,
                    onlineMode: 0,
                    outsideGatewayIP: '',
                    outsideIp: '',
                    isBlindPlay: 0,
                    touchType: 1,
                    deployMode: 2,
                    hwChangeIp: '1',
                    isBasicScore: 0,
                    oneScore: 100,
                    basicDeduction: 10,
                    isExtraCredit: 0,
                    isSupergroup: 0,
                    isAllowApplicationPrompt: this.type !== 8 ? 1 : 0,
                    ExtraCreditValue1: 6,
                    ExtraCreditValue2: 4,
                    ExtraCreditValue3: 2,
                    ExtraCreditValue4: 1,
                    ExtraCredit1: 1,
                    ExtraCredit2: 1,
                    ExtraCredit3: 1,
                    ctfDeduction: 20,
                    scoringType:1,
                    typeIp:'1211',
                    teamIpCount: 2,
                    competeSysSubnetsID:'' ,
                    publicSubnetId:'',
                    questionMinScore:300,  //每题最低分数
                    questionAllowDefendCount:10, //每题允许提交防御次数
                    submitTime:1, //多长时间
                    submitCount:1, //提交多少次
                    attackTimeframe:[{time:[]}], //攻击时段
                    defendTimeframe:[{time:[]}], //防守时段
                    curveDecelerateRate:5,
                    envType:1,
                    testType:'',
                    testProduct:'',
                    // endClearConfig:0
                };
            } else {
                this.formValidate = {
                    id: '',
                    accessGroupUsers: [],
                    description: '',
                    endTime: '',
                    iconPath: '',
                    name: '',
                    startTime: '',
                    Dates: [],
                };
            }
        },
        // 展示创建/修改演练/竞赛的模态框
        async showAddAndUpdate(info) {
            console.log(info);
            this.sceneModal.tabName = 'custom';
            // 初始化数据
            this.initData();

            if (this.type !== 2) {
                // 非夺旗赛都需要查询工程列表
                this.getPrjList();
                if(this.type === 17){ //安全测试
                    this.getProductList(); //资产列表
                }
            } else {
                // 夺旗赛只在修改操作时需要查询工程列表
                if (info) {
                    this.getPrjList();
                }
            }
            this.sceneModal.show = true;
            this.templateList = [];
            this.templateAccessGroupList = [];
            if (this.type == 0) {
                let params = {
                    name: 'hlConfig',
                };
                await getDictInfoByName(params)
                    .then((res) => {
                        if (res.code == 1) {
                            this.formValidate.hlConfig = res.attribute.data.value;
                        } else {
                            this.formValidate.hlConfig = 0;
                        }
                    })
                    .catch((err) => {
                        console.log(err);
                    });
            }else if(this.type === 2){
                let params = {
                    name: 'ctfEnvType',
                };
                await getDictInfoByName(params)
                    .then((res) => {
                        if (res.code == 1) {
                            this.showCtfEnvType = res.attribute.data.value === '1' ? true : false;
                        } else {
                            this.showCtfEnvType = false;
                        }
                    })
                    .catch((err) => {
                        this.showCtfEnvType = false;
                        console.log(err);
                    });
            }
            if (!info) {
                // 没有数据则是创建动作
                this.sceneModal.title = `创建${this.title}`; //${this.typeFilter(this.type)}
                this.sceneModal.type = '1';
                this.iconPath = '';
                this.showExtraCredit = false;
                // 默认创建延迟三分钟开始，时长一小时的竞赛/演练
                this.formValidate.Dates = [
                    this.timestampToTime(new Date().getTime() + 60 * 60 * 1000),
                    this.timestampToTime(new Date().getTime() + 60 * 120 * 1000),
                ];
                this.timeChange(this.formValidate.Dates);
                //  1：攻防赛 2：夺旗赛  8：攻防plus  9:运维赛 通过运维配置获取公网子网ID 
                if ([1, 8, 9].includes(this.type)) {
                    await getDictInfoByName({ name: 'competeSysSubnets' }).then((res) => {
                        if (res.code == 1) {
                            this.competeSysSubnetsID = res.attribute.data.value;
                            this.$set(this.formValidate, 'publicSubnetId', this.competeSysSubnetsID);
                        } else {
                            this.competeSysSubnetsID = ''
                            this.$message.warning(res.message);
                        }
                    }).catch((error) => {
                        this.competeSysSubnetsID = ''
                        this.$message.error(error);
                    })
                }
            } else {
                // 修改动作
                this.sceneModal.title = `修改${this.title}`; //${this.typeFilter(this.type)}
                this.sceneModal.type = '2';
                this.formValidate = JSON.parse(JSON.stringify(info));
                let src = info.iconPath; //.slice(1);
                this.iconSrc = `/Learn/${src}`;
                this.$set(this.formValidate, 'Dates', [this.formValidate.startTime, this.formValidate.endTime]);
                let extension = parseJson(this.formValidate.extension);
                // 将扩展字段中的数据填充进表格对象
                this.$set(
                    this.formValidate,
                    'cycleTime',
                    extension.cycleTime || (this.type == 8 ? 20 : 5)
                );
                // 没有设置答题模式时，渗透演练默认为顺序答题，综合演练默认为随意答题
                this.$set(
                    this.formValidate,
                    'stMode',
                    extension.stMode === undefined ? (this.type === 4 ? 0 : 1) : extension.stMode
                );
                this.$set(this.formValidate, 'scoreMode', extension.scoreMode || 0);
                this.$set(this.formValidate, 'wpUpMode', extension.wpUpMode || 1);
                this.$set(this.formValidate, 'hlConfig', extension.hlConfig || 0);
                this.$set(this.formValidate, 'isDistributed', extension.isDistributed || 0);
                if (this.formValidate.isDistributed == 1) {
                    this.$set(this.formValidate, 'isMainRange', extension.isMainRange || 1);
                }
                this.$set(this.formValidate, 'targetScore', extension.targetScore || 5000);
                this.$set(
                    this.formValidate,
                    'cycleScore',
                    extension.cycleScore || (this.type == 8 || this.hlConfig == 2 ? 100 : 10)
                );
                this.$set(this.formValidate, 'basicScore', extension.basicScore || 5000);
                this.$set(this.formValidate, 'enResetNum', extension.enResetNum || 3);
                this.$set(this.formValidate, 'resetLostScore', extension.resetLostScore || 100);
                this.$set(this.formValidate, 'isBlindPlay', extension.isBlindPlay || 0);
                this.$set(this.formValidate, 'touchType', extension.touchType || 1);
                this.$set(this.formValidate, 'deployMode', extension.deployMode || 2);
                this.$set(
                    this.formValidate,
                    'hwChangeIp',
                    extension.hwChangeIp === undefined ? '0' : extension.hwChangeIp
                );
                this.$set(this.formValidate, 'isBasicScore', extension.isBasicScore || 0);
                this.$set(this.formValidate, 'oneScore', extension.oneScore || 100);
                this.$set(this.formValidate, 'basicDeduction', extension.basicDeduction || 10);
                this.$set(this.formValidate, 'onlineMode', extension.onlineMode || 0);
                this.$set(this.formValidate, 'high', extension.high || 5);
                this.$set(this.formValidate, 'middle', extension.middle || 3);
                this.$set(this.formValidate, 'low', extension.low || 1);
                this.$set(this.formValidate, 'isExtraCredit', extension.isExtraCredit || 0);
                this.$set(this.formValidate, 'isSupergroup', extension.isSupergroup || 0);
                this.$set(
                    this.formValidate,
                    'isAllowApplicationPrompt',
                    extension.isAllowApplicationPrompt === undefined
                        ? 1
                        : extension.isAllowApplicationPrompt
                );
                this.$set(this.formValidate, 'networkModel', extension.onLineType || 'lan');
                this.showExtraCredit = !!this.formValidate.isExtraCredit; // 有激励分时才展示激励分设置，需要布尔值
                this.$set(this.formValidate, 'ExtraCreditValue1', extension.ExtraCreditValue1 || 6);
                this.$set(this.formValidate, 'ExtraCreditValue2', extension.ExtraCreditValue2 || 4);
                this.$set(this.formValidate, 'ExtraCreditValue3', extension.ExtraCreditValue3 || 2);
                this.$set(this.formValidate, 'ExtraCreditValue4', extension.ExtraCreditValue4 || 1);
                this.$set(this.formValidate, 'ExtraCredit1', extension.ExtraCredit1 || 1);
                this.$set(this.formValidate, 'ExtraCredit2', extension.ExtraCredit2 || 1);
                this.$set(this.formValidate, 'ExtraCredit3', extension.ExtraCredit3 || 1);
                this.$set(this.formValidate, 'ctfDeduction', extension.ctfDeduction || 20);
                this.$set(this.formValidate, 'outsideGatewayIP', extension.outsideGatewayIP || '');
                const s1 =  extension.publicSubnetId
                const s2 =  extension.teamPublicSubnetId?extension.teamPublicSubnetId.split(','):''
                const res  = [s1,...s2]

                let typeIp = '1211'
                Object.keys(extension).forEach(item=>{
                    if(item=='vpn1211'){
                        typeIp = '1211'
                        
                    }else if(item=='vpn1212'){
                        typeIp = '1212'
                    }
                })
                // this.$nextTick(()=>{
                //     this.$set(this.formValidate, 'publicSubnetId', res || '');
                // })
                this.$set(this.formValidate, 'typeIp', typeIp || '1211');
                this.$set(this.formValidate, 'teamIpCount', extension.teamIpCount|| 2);
                // this.$set(this.formValidate, 'endClearConfig', extension.endClearConfig || 0);
                if(this.type === 5 && this.extension === 1){ //新护网
                    if(typeIp=='1211'){
                       if(s1==s2){
                        this.$set(this.formValidate, 'publicSubnetId',[s1]);
                       }else{
                        this.$set(this.formValidate, 'publicSubnetId',res);
                       }
                        
                    }else{
                        this.$set(this.formValidate, 'publicSubnetId', s1);
                        console.log(this.formValidate);
                    }
                    this.$set(this.formValidate, 'scoringType', extension.scoringType || 0);
                }else{
                    this.$set(this.formValidate, 'publicSubnetId', s1);
                }
                if(this.type === 8){
                    this.$set(this.formValidate, 'scoringType', extension.scoringType || 0);
                    if(extension.scoringType === 1){ //攻防单独计分模式
                        this.$set(this.formValidate, 'curveDecelerateRate', extension.curveDecelerateRate || 5);
                        this.$set(this.formValidate, 'questionMinScore', extension.questionMinScore || 300);
                        this.$set(this.formValidate, 'questionAllowDefendCount', extension.questionAllowDefendCount || 10);
                        this.$set(this.formValidate, 'submitTime', extension.submitTime || 1);
                        this.$set(this.formValidate, 'submitCount', 1);
                        this.$set(this.formValidate, 'attackTimeframe', extension.attackTimeframe.map(item => {
                            return {
                                time:[item.startTime,item.endTime]
                            }
                        }));
                        this.$set(this.formValidate, 'defendTimeframe', extension.defendTimeframe.map(item => {
                            return {
                                time:[item.startTime,item.endTime]
                            }
                        }));
                    }
                }
                if(this.type === 2){
                    this.$set(this.formValidate, 'envType', extension.envType === 0 ? 0 : 1); //默认独享
                }
                if(this.type === 17){
                    this.$set(this.formValidate, 'testType', extension.testType); //默认独享
                    this.$set(this.formValidate, 'testProduct', extension.testProduct); //默认独享
                }
                if(this.type !== 17){
                    this.getPrjSceneList(info.projectId);
                }
                // 目前修改不需要展示以往的图片，所以注释了下方的语句，需要展示的时候取消注释即可
                // this.formValidate.iconPath = `/Learn${src}`;
            }
        },
        // 切换工程时，将工程名称同步为工程的名称，同时查询工程关联的工程场景
        getPrjName(prjInfo) {
            if (!prjInfo) {
                return;
            }
            if (this.type == 0 || this.type == 7) {
                console.log(prjInfo, 'prjInfoprjInfo');
                let choose = this.prjlists.filter((item) => {
                    return item.id == prjInfo.value;
                });
                this.prjType = choose[0].type;
                console.log(this.prjType, 'prjType');
                if (this.prjType == 'distributed') {
                    this.formValidate.isDistributed = 1;
                } else {
                    this.formValidate.isDistributed = 0;
                }
            }

            if (prjInfo) {
                if(this.type !== 17){
                    this.formValidate.id = '';
                }
                this.formValidate.projectName = prjInfo.label;
                if ([0, 7].includes(this.type)) {
                    // 对抗演练、综合演练直接使用工程的名称，其他类型演练、竞赛名称需要查询场景工程后设置
                    this.formValidate.name = prjInfo.label;
                }
                if (this.type === 5) {
                    // 护网演练额外查询部署模式、是否可更换外网IP
                    let item = this.prjlists.find((item) => item.id === prjInfo.value) || {};
                    let projectIn = item && (item.projectIn || {});
                    this.formValidate.deployMode = projectIn.hwDeployMode === 'route' ? 2 : 1;
                    // 对象中保存的事ture/false，转义为‘1’/‘0’
                    this.formValidate.hwChangeIp =
                        projectIn.hwChangeIp === undefined ? '0' : projectIn.hwChangeIp ? '1' : '0';
                }
                // 查询工程场景
                if(this.type !== 17){
                    this.getPrjSceneList(prjInfo.value);
                }
            }
        },
        // 切换工程场景时，设置名称为对应的场景名称
        getTestName(testInfo) {
            if (testInfo && this.type != 0) {
                this.formValidate.name = testInfo.label;
            }
        },
        // 添加演练、竞赛
        addScene(data) {
            if ([1, 2, 4, 5, 8, 9].includes(this.type)) {
                // 添加攻防赛、夺旗赛、渗透演练、护网演练时、攻防赛Plus，默认设置为简单模式
                let extension = parseJson(data.extension);
                extension.configMode = 1;
                data.extension = JSON.stringify(extension);
            }
            addScene(data)
                .then((data) => {
                    if (data.code == 1) {
                        this.handleReset('formValidate');
                        this.sceneModal.show = false;
                        this.formValidate.publicSubnetId = null
                        this.$Message.info('创建场景成功');
                        this.refreshSceneList(); //创建完成清空查询条件并回到第一页
                    } else {
                        this.cancelLoading(this.sceneModal);
                        this.$Message.warning(data.message);
                    }
                })
                .catch((error) => {
                    this.cancelLoading(this.sceneModal);
                    this.$Message.error('创建场景失败，请检查网络设置');
                });
        },
        bindPro(pro){
            this.createProModal = false;
            this.modifyScene(this.currScene.id,{
                projectId:pro.id,
                projectName:pro.name,
            },'bindPro')
        },
        // 修改演练、竞赛
        modifyScene(id, data, type) {
            modifyScene(id, data)
                .then((data) => {
                    if (data.code == 1) {
                        this.$Message.info(type === 'bindPro' ? '构建工程成功':'修改场景成功');
                        this.sceneModal.show = false;
                        this.formValidate.publicSubnetId = null
                        this.getSceneList();
                    } else {
                        this.cancelLoading(this.sceneModal);
                        this.$Message.warning(data.message);
                    }
                })
                .catch((error) => {
                    this.cancelLoading(this.sceneModal);
                    if(type === 'bindPro'){
                        this.$Message.error('构建工程失败，请检查网络设置');
                    }else{
                        this.$Message.error('修改场景失败，请检查网络设置');
                    }
                });
        },
        // 创建、修改竞赛、演练的模态框打开时，重置表单，清空校验信息
        createVisibleChange(type) {
            if (type) {
                this.$refs.formValidate.resetFields();
                this.showTip = false;
            }
        },
        // 保存演练、竞赛数据，分为新增、修改两种模式
        saveScene(name) {
            if (this.sceneModal.type == '1' && [1, 8, 9].includes(this.type) && !this.competeSysSubnetsID) {
                this.$Message.warning('请先在运维系统配置公网子网ID')
                this.cancelLoading(this.sceneModal);
                return;
            }
            // 自定义
            if (this.sceneModal.tabName === 'custom') {
                this.$refs[name].validate((valid) => {
                    if (valid) {
                        // 设置图片为必填项时，需要使用到下面注释的代码
                        // if(!this.formValidate.iconPath){
                        //     this.uploaderror = true;
                        //     this.cancelLoading(this.sceneModal);
                        //     return;
                        // }
                        let data = JSON.parse(JSON.stringify(this.formValidate));
                        console.log(data.publicSubnetId);
                        if (!data.startTime || !data.endTime) {
                            this.$Message.error('请选择时间!');
                            this.cancelLoading(this.sceneModal);
                            return;
                        }
                        if (
                            this.formValidate.progress != 2 &&
                            new Date(data.startTime).getTime() < new Date().getTime()
                        ) {
                            this.$Message.error('表单输入有误，开始时间不能小于当前时间!');
                            this.cancelLoading(this.sceneModal);
                            return;
                        }
                        if (new Date(data.startTime).getTime() > new Date(data.endTime).getTime()) {
                            this.$Message.error('表单输入有误，开始时间不能大于结束时间!');
                            this.cancelLoading(this.sceneModal);
                            return;
                        }
                        delete data.Dates;
                        let obj = {};
                        if (this.type == 0) {
                            // 对抗演练
                            obj = {
                                cycleTime: data.cycleTime,
                                hlConfig: Number(data.hlConfig),
                                isDistributed: data.isDistributed,
                                isMainRange:
                                    data.isDistributed === 1 ? data.isMainRange : undefined,
                                ExtraCreditValue1:
                                    data.hlConfig == 2 ? data.ExtraCreditValue1 : undefined,
                                ExtraCreditValue2:
                                    data.hlConfig == 2 ? data.ExtraCreditValue2 : undefined,
                                ExtraCreditValue3:
                                    data.hlConfig == 2 ? data.ExtraCreditValue3 : undefined,
                                ExtraCreditValue4:
                                    data.hlConfig == 2 ? data.ExtraCreditValue4 : undefined,
                                ExtraCredit1: data.hlConfig == 2 ? data.ExtraCredit1 : undefined,
                                ExtraCredit2: data.hlConfig == 2 ? data.ExtraCredit2 : undefined,
                                ExtraCredit3: data.hlConfig == 2 ? data.ExtraCredit3 : undefined,
                                cycleScore: data.cycleScore,
                            };
                        }
                        if (this.type == 1) {
                            // 攻防赛、攻防赛Plus
                            obj = {
                                cycleTime: data.cycleTime,
                                deployMode: data.deployMode,
                                cycleScore: data.cycleScore,
                                publicSubnetId:
                                    data.deployMode === 2 ? data.publicSubnetId : undefined,
                            };
                        }
                        if (this.type == 8) {
                            if(data.scoringType == 0){ // 混合计分模式
                                obj = {
                                    cycleTime: data.cycleTime,
                                    deployMode: data.deployMode,
                                    cycleScore: data.cycleScore,
                                    publicSubnetId:
                                        data.deployMode === 2 ? data.publicSubnetId : undefined,
                                    basicScore: data.basicScore,
                                    enResetNum: data.enResetNum,
                                    resetLostScore: data.resetLostScore,
                                    isAllowApplicationPrompt: data.isAllowApplicationPrompt, // 非基础分模式记录是否允许申请提示
                                    // 非基础分模式下允许申请提示记录申请提示扣分比例
                                    ctfDeduction:
                                        data.isAllowApplicationPrompt === 1
                                            ? data.ctfDeduction
                                            : undefined,
                                };
                            }else{
                                obj = {
                                    deployMode: data.deployMode,
                                    cycleScore: data.cycleScore,
                                    scoringType:data.scoringType,
                                    basicScore:0,
                                    publicSubnetId:
                                        data.deployMode === 2 ? data.publicSubnetId : undefined,
                                    deployMode: data.deployMode,
                                    cycleTime: data.cycleTime,
                                    isAllowApplicationPrompt: data.isAllowApplicationPrompt, // 非基础分模式记录是否允许申请提示
                                    // 非基础分模式下允许申请提示记录申请提示扣分比例
                                    ctfDeduction:
                                        data.isAllowApplicationPrompt === 1
                                            ? data.ctfDeduction
                                            : undefined,
                                    questionMinScore:data.questionMinScore,
                                    questionAllowDefendCount:data.questionAllowDefendCount,
                                    submitCount:1,
                                    submitTime:data.submitTime,
                                    curveDecelerateRate:data.curveDecelerateRate,
                                    attackTimeframe:data.attackTimeframe.map(item => {
                                        return {
                                            startTime:item.time[0],
                                            endTime:item.time[1]
                                        }
                                    }),
                                    defendTimeframe:data.defendTimeframe.map(item => {
                                        return {
                                            startTime:item.time[0],
                                            endTime:item.time[1]
                                        }
                                    }),
                                }
                                delete data.scoringType;
                                delete data.attackTimeframe;
                                delete data.defendTimeframe;
                                delete data.questionMinScore;
                                delete data.questionAllowDefendCount;
                                delete data.submitTime;
                                delete data.curveDecelerateRate;
                            }
                        }
                        if (this.type == 4) {
                            // 渗透演练
                            obj = {
                                stMode: data.stMode,
                                wpUpMode: data.wpUpMode,
                            };
                        }
                        if (this.type == 7) {
                            // 综合演练
                            obj = {
                                stMode: data.stMode,
                                scoreMode: this.formValidate.stMode == 1 && this.formValidate.wpUpMode == 2 ? data.scoreMode : 0,
                                wpUpMode: data.wpUpMode,
                                isDistributed: data.isDistributed,
                                isMainRange:
                                    data.isDistributed === 1 ? data.isMainRange : undefined,
                            };
                        }
                        if (this.type == 5) {
                            // 护网演练
                            if (
                                this.checkeScore(data.high) ||
                                this.checkeScore(data.middle) ||
                                this.checkeScore(data.low)
                            ) {
                                this.$Message.error('靶标分数必填，请输入大于1~100的整数');
                                this.cancelLoading(this.sceneModal);
                                return;
                            }
                            // if(this.extension==1)
                            // if(this.formValidate.typeIp=='1211'&& this.formValidate.publicSubnetId.length<2){
                            //     this.$Message.error('公网子网选项最少为2项');
                            //     this.cancelLoading(this.sceneModal);
                            //     return;
                            // }
                            obj = {
                                targetScore: data.targetScore,
                                high: data.high,
                                middle: data.middle,
                                low: data.low,
                                deployMode: data.deployMode,
                                hwChangeIp: data.hwChangeIp,
                                publicSubnetId: Array.isArray(data.publicSubnetId)?data.publicSubnetId[0]:data.publicSubnetId ,
                                chargeMode: data.hwChangeIp === '1' ? 1 : undefined, // 允许更换外网ip时，设置计费模式，目前暂时默认为1
                                switchNum: data.hwChangeIp === '1' ? 5 : undefined, // 同上，设置允许切换5次
                                maxBandwidth: data.hwChangeIp === '1' ? 1 : undefined, // 同上，设置最大贷款1M
                                hwType:  this.extension == 4 ? 3: this.extension, // 3 仿真 传3 ，这里前面的参数太乱了
                            };
                            if(this.extension == 2) {
                                obj.vpn = true
                            }
        
                            if(this.extension === 1){ //新护网
                                // delete obj.deployMode
                                obj.teamIpCount = parseInt(data.teamIpCount)
                                if(Array.isArray(data.publicSubnetId)){
                                if(data.publicSubnetId.length==1){
                                    obj.teamPublicSubnetId = data.publicSubnetId[0]
                                }else{
                                    obj.teamPublicSubnetId =data.publicSubnetId.slice(1).join(',')
                                }
                             }else{
                                obj.teamPublicSubnetId = data.publicSubnetId
                             }
                                obj.scoringType = data.scoringType;
                                if(this.formValidate.typeIp==='1211' && (this.type==5&&this.extension==1)){
                                    obj.vpn1211 = true
                                    delete obj.vpn1212
                                }else if(this.formValidate.typeIp==='1212' &&  (this.type==5&&this.extension==1)){
                                    obj.vpn1212 = true
                                    delete obj.vpn1211
                                }
                            }
                            if(this.extension === 3){ //日常渗透
                                obj.hwExtentionType = 2
                                obj.needEnv = false
                                obj.hwType = 0
                                // 用于无环境的快速配置时增加跳过步骤11和12
                                obj.hwChangeIp = 1
                                obj.deployMode = 1
                                obj.chargeMode = undefined
                                obj.switchNum = undefined
                                obj.maxBandwidth = undefined
                            }
                        }
                        if (this.type == 2) {
                            // 夺旗赛
                            obj = {
                                onlineMode: data.onlineMode,
                                isBlindPlay: data.isBlindPlay,
                                touchType:
                                    data.isBlindPlay === 1 && data.isBasicScore === 0
                                        ? data.touchType
                                        : undefined, // 使用盲打，并且不是基础分模式，才记录盲打模式种类
                                deployMode: data.deployMode,
                                isBasicScore: data.isBasicScore,
                                wpUpMode: data.wpUpMode,
                                isDistributed: data.isDistributed,
                                isMainRange:
                                    data.isDistributed === 1 ? data.isMainRange : undefined,
                                oneScore: data.isBasicScore === 1 ? data.oneScore : undefined, // 基础分模式记录一血得分
                                basicDeduction:
                                    data.isBasicScore === 1 ? data.basicDeduction : undefined, // 基础分模式记录得分扣分比例
                                isSupergroup:
                                    data.isBasicScore !== 1 ? data.isSupergroup : undefined, // 非基础分模式记录是否使用大组
                                isAllowApplicationPrompt:
                                    data.isBasicScore !== 1
                                        ? data.isAllowApplicationPrompt
                                        : undefined, // 非基础分模式记录是否允许申请提示
                                // 非基础分模式下允许申请提示记录申请提示扣分比例
                                ctfDeduction:
                                    data.isBasicScore !== 1 && data.isAllowApplicationPrompt === 1
                                        ? data.ctfDeduction
                                        : undefined,
                                isExtraCredit:
                                    data.isBasicScore !== 1 ? data.isExtraCredit : undefined, // 非基础分模式记录激励分
                                // 非基础分模式下有激励分，记录各激励分数据
                                ExtraCreditValue1:
                                    data.isExtraCredit && data.isBasicScore !== 1
                                        ? data.ExtraCreditValue1
                                        : undefined,
                                ExtraCreditValue2:
                                    data.isExtraCredit && data.isBasicScore !== 1
                                        ? data.ExtraCreditValue2
                                        : undefined,
                                ExtraCreditValue3:
                                    data.isExtraCredit && data.isBasicScore !== 1
                                        ? data.ExtraCreditValue3
                                        : undefined,
                                ExtraCredit1:
                                    data.isExtraCredit && data.isBasicScore !== 1
                                        ? data.ExtraCredit1
                                        : undefined,
                                ExtraCredit2:
                                    data.isExtraCredit && data.isBasicScore !== 1
                                        ? data.ExtraCredit2
                                        : undefined,
                                ExtraCredit3:
                                    data.isExtraCredit && data.isBasicScore !== 1
                                        ? data.ExtraCredit3
                                        : undefined,
                                outsideGatewayIP:
                                    data.onlineMode === 1 ? data.outsideGatewayIP : undefined,
                                onLineType: data.onlineMode === 1 ? data.networkModel : undefined,
                                publicSubnetId:
                                    data.onlineMode === 1 || data.deployMode === 2
                                        ? data.publicSubnetId
                                        : undefined,
                                envType:data.envType
                            };
                        }
                        if (this.type == 9) {
                            // 运维赛
                            obj = {
                                isAllowApplicationPrompt: data.isAllowApplicationPrompt, // 非基础分模式记录是否允许申请提示
                                // 非基础分模式下允许申请提示记录申请提示扣分比例
                                ctfDeduction:
                                    data.isAllowApplicationPrompt === 1
                                        ? data.ctfDeduction
                                        : undefined,
                                deployMode: data.deployMode,
                                publicSubnetId:
                                    data.deployMode === 2 ? data.publicSubnetId : undefined,
                                wpUpMode: data.wpUpMode,
                            };
                        }
                        if (this.type == 10) {
                            //应急演练
                            obj = {
                                isDistributed: data.isDistributed, //是否未分布式
                                wpUpMode: data.wpUpMode, //提交报告模式
                            };
                        }
                        if(this.type == 17){
                            //安全测试
                            obj = {
                                testType: data.testType, //测试类型
                                testProduct: data.testProduct, //关联资产
                            };
                            delete data.testType;
                            delete data.testProduct;
                        }
                        let extension = parseJson(this.formValidate.extension);
                        // obj.endClearConfig = data.endClearConfig;
                        extension = Object.assign(extension, obj); // 将改动后的值覆盖之前的内容
                        data.extension = JSON.stringify(extension); // 将数据转义成字符并保存在扩展字段中
                        //const  teamPublicSubnetId=data.publicSubnetId.length==1?data.publicSubnetId[0]:data.publicSubnetId.slice(1).join(',')
                        //data.teamPublicSubnetId = teamPublicSubnetId
                        //data.publicSubnetId = data.publicSubnetId[0]
                        if (this.sceneModal.type == '1') {
                            // 添加场景
                            this.addScene(data);
                        } else if (this.sceneModal.type == '2') {
                            // 修改场景
                            this.modifyScene(data.id, data);
                        }
                    } else {
                        this.$Message.error('表单输入有误，请查看页面信息后重新输入!');
                        this.cancelLoading(this.sceneModal);
                    }
                }).catch(error => {
                    this.cancelLoading(this.sceneModal);
                });
            } else {
                this.$refs[name]
                    .validate((valid) => {
                        console.log(this.formValidate, valid, '验证');
                        if (valid) {
                            let id = this.formValidate.id;
                            let {
                                accessGroupUsers,
                                description,
                                endTime,
                                iconPath,
                                name,
                                startTime,
                            } = this.formValidate;
                            let data = {
                                accessGroupUsers: accessGroupUsers.map((item) => {
                                    return {
                                        id: item.id,
                                        testId: item.testId,
                                        userIds: item.userIds,
                                    };
                                }),
                                description,
                                endTime,
                                iconPath,
                                name,
                                startTime,
                            };
                            this.quickBuildScene(
                                id,
                                data,
                                (message) => {
                                    this.handleReset('formValidate');
                                    this.sceneModal.show = false;
                                    this.$Message.info('创建场景成功');
                                    this.refreshSceneList(); //创建完成清空查询条件并回到第一页
                                },
                                (message) => {
                                    this.cancelLoading(this.sceneModal);
                                    this.$Message.error(message);
                                }
                            );
                        } else {
                            this.cancelLoading(this.sceneModal);
                        }
                    })
                    .catch(() => {
                        this.cancelLoading(this.sceneModal);
                    });
            }
        },
        // 测试输入是否为大于0的正整数
        checkeScore(val) {
            return !Number.isInteger(val) || val <= 0 || val > 100;
        },
        // 隐藏删除模态框，并将需要删除的演练、竞赛设置为空
        closeDelModal() {
            this.delDrillModal = false;
            this.curDelScene = {};
        },
        // 显示删除的确认框，并设置当前需要删除的演练、竞赛
        delSceneTip(scene) {
            this.enableDelProject = 0;
            if (scene.projectId) {
                // 存在工程时，才询问是否需要删除工程
                this.hasProject = true;
                if(this.type == 18){
                    this.enableDelProject = 1; //赛前练习直接删除工程
                    this.hasProject = false; //赛前练习不询问直接删除工程
                }
            } else {
                this.hasProject = false;
            }
            this.delDrillModal = true;
            this.curDelScene = scene;
        },
        // 删除演练、竞赛
        delScene() {
            let isDelTest = this.enableDelProject ? true : false; // 是否需要同步删除工程、场景
            if(this.showDelLoophole && false){
                let isDelloop = this.delLoophole ? true : false // 删除漏洞记录
            }
            this.delModalLoading = true;
            delScene(this.curDelScene.id, isDelTest)
                .then((data) => {
                    if (data.code == 1) {
                        this.getSceneList();
                        this.$Message.info('操作成功');
                        this.delDrillModal = false;
                    } else {
                        this.$Message.error(data.message);
                    }
                    this.delModalLoading = false;
                })
                .catch(() => {
                    this.$Message.error('删除场景异常');
                });
        },
        // 取消loading状态
        cancelLoading(modal) {
            modal.loading = false;
            setTimeout(() => {
                modal.loading = true;
            });
        },
        // 刷新表单数据
        handleReset(name) {
            this.$refs[name].resetFields();
            this.iconSrc = '';
            this.formValidate.iconPath = '';
            this.formValidate.publicSubnetId = null
            this.formValidate.Dates = [];
        },
        // 图片上传异常时，显示图片的格式要求
        handleFormatError() {
            this.showTip = true;
        },
        // 修改时间时，验证时间的正确性并自动设置正确时间
        timeChange(timeArr) {
            if (timeArr.length > 0) {
                if (new Date(timeArr[0]).getTime() < new Date().getTime()) {
                    // 如果开始时间小于当前时间
                    this.formValidate.Dates = [
                        this.timestampToTime(new Date().getTime() + 60 * 60 * 1000),
                        timeArr[1],
                    ];
                    this.timeChange(this.formValidate.Dates);
                    return;
                }
                if (new Date(timeArr[1]).getTime() < new Date(timeArr[0]).getTime()) {
                    // 如果结束时间小于开始时间
                    this.formValidate.Dates = [
                        timeArr[0],
                        this.timestampToTime(new Date(timeArr[0]).getTime() + 60 * 60 * 1000),
                    ];
                    this.timeChange(this.formValidate.Dates);
                    return;
                }
                this.formValidate.startTime = timeArr[0] ? timeArr[0] + ':00' : '';
                this.formValidate.endTime = timeArr[1] ? timeArr[1] + ':00' : '';
            }
        },
        // 将时间戳转义为字符串
        timestampToTime(timestamp) {
            let date = new Date(timestamp); //时间戳为10位需*1000，时间戳为13位的话不需乘1000
            let Y = date.getFullYear() + '-';
            let M =
                (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) +
                '-';
            let D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ';
            let h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
            let m = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
            return Y + M + D + h + m;
        },
        // 上传图片成功后的回调函数，获取图片上传后的保存的位置，用于回显图片
        getImageUrl(res) {
            this.showTip = false;
            if (res.code == 1) {
                let src = res.data;
                this.uploaderror = false;
                this.formValidate.iconPath = src;
                this.iconSrc = `/Learn${src}`;
            } else {
                this.$Message.error('文件上传失败');
            }
        },
        // 展示重新部署组件，并保存需要部署的竞赛、演练的信息
        isreconstruction(item) {
            this.reconstruction = true;
            this.item = item;
            this.reconstructionText =
                item.projectId && item.available ? '是否再次部署' : '是否重新构建';
            this.reconstructionTitle = item.name;
        },
        // 有环境就再次部署，没有环境就重新构建
        reconstructionOk() {
            let item = this.item;
            this.reQuickCreateContent(item.id, item, !(item.projectId && item.available));
            this.reconstruction = false;
        },
        visibleChange(flag) {
            if (!flag) {
                this.vertical = '';
            }
        },
        // 重新构建、再次部署，目前仅用于夺旗赛
        reQuickCreateContent(id, item, type) {
            // 未勾选时，什么都不做
            if (type === '') {
                return;
            }
            this.$set(item, 'isSending', true); // 这个属性似乎没用到，只看到复制，没看到使用
            let extension = parseJson(item.extension);
            let modeType = extension.onlineMode || 0;
            reQuickCreateContent(id, modeType, type)
                .then((data) => {
                    this.$set(item, 'isSending', false);
                    if (data.code === 1) {
                        this.$Message.info(`${type ? '重新构建成功' : '再次部署成功'}`);
                        this.getSceneList();
                    } else {
                        this.$Message.warning(data.message);
                    }
                })
                .catch((error) => {
                    this.$Message.error(
                        error.response.data.message || `${type ? '重新构建异常' : '再次部署异常'}`
                    );
                })
                .finally(() => {
                    this.$set(item, 'isSending', false);
                });
        },
        // 设置按钮禁用状态，返回true为禁用
        setReBtnStatus(params, type) {
            let userid = params.creator;
            if (this.type == 5 && this.extension === 1) {
                //新护网
                //先单独处理一下护网，赛中需要修改比赛名称
                let statusArr = type == 'modify' ? [5] : [2, 5];
                if (userid === this.USER_ID && !statusArr.includes(params.progress)) {
                    return false;
                } else {
                    return true;
                }
            }
            if(this.type === 18){
                if(params.progress === 2 || !this.isRootDesigner){
                    return true;
                }else{
                    return false;
                }
            }
            if (userid === this.USER_ID && ![2, 5].includes(params.progress)) {
                // 属于自己的竞赛、演练，非开始中、暂停的状态都可以修改
                if ([1, 2, 4, 5, 8, 9].includes(this.type) && type == 'modify') {
                    // 夺旗赛、攻防赛、渗透、护网的修改操作，需要判断快速构建是否已经部署成功
                    let status = params.isBatchDeployment
                        ? params.quickCreateStatus
                        : params.deployStatus; // 视是否为快速构建判断使用哪个字段来判断是否已部署成功
                    let dis = status == 3 || status == 'complete'; // 状态是否为部署成功
                    return !dis; //
                } else {
                    return false;
                }
            } else {
                return true;
            }
        },
        // 获取公网子网列表
        queryPublicSubnets() {
            if (this.formValidate.onlineMode === 1) {
                // 线上赛时，将部署模式重新设置回数据通道模式
                this.$set(this.formValidate, 'deployMode', 1);
            } else {
                this.$set(this.formValidate, 'deployMode', 2);
            }
            if (this.formValidate.onlineMode === 1 || this.formValidate.deployMode === 2) {
                // 线上赛、理由模式的线下赛时，获取公网子网列表
                queryPublicSubnets()
                    .then((data) => {
                        if (data.code == 1) {
                            this.publicSubnets = data.data.list;
                            if ([1, 8, 9].includes(this.type)) {
                                this.getAvailableIP(this.formValidate.publicSubnetId)
                            }
                        } else {
                            this.publicSubnets = [];
                        }
                    })
                    .catch((error) => {
                        this.$Message.error('服务异常');
                    });
            }
        },
        // 切换公网子网时，查询可用IP
        getAvailableIP(subnetId) {
            if (!subnetId) {
                return;
            }
            let subnet = this.publicSubnets.filter((subnet) => subnet.id == subnetId)[0];
            this.formValidate.outsideGatewayIP = subnet&&subnet.gatewayIp;
        },
        handleRadioChange(){
            this.$set(this.formValidate, 'publicSubnetId','');
        },  
        // 演练、竞赛详情页跳转，提供给子组件调用
        toDetailPage(data) {
            const extensionObj =  JSON.parse( data.extension)
            console.log(extensionObj);
            sessionStorage.setItem('queryObj', this.queryObj);
            let path;
            switch (Number.parseInt(data.type)) {
                case 0:
                    path = '/awdDrillDetail';
                    break;
                case 1:
                    path = '/awdContestDetail';
                    break;
                case 2:
                    path = '/ctfContestDetail';
                    break;
                case 3: // 知识赛不在这里跳转
                    path = '';
                    break;
                case 4:
                    path = '/stDrillDetail';
                    break;
                case 5:
                    if(this.extension === 0) {
                        path = '/swDrillDetail'
                    }else if(this.extension === 1){
                        // Object.keys(extensionObj).forEach(item=>{
                        //     if(item.includes('vpn1211')||item.includes('vpn1212')){
                        //         path = '/zcDrillDetail2'
                        //     }else{
                        //         path = '/hwDrillDetail'
                        //     }
                        // })
                        if ('vpn1211' in extensionObj) {
                            path = '/newHwDetail'
                        }else if('vpn1212' in extensionObj){
                            path = '/newHwDetail'
                        }else{
                            path = '/hwDrillDetail'
                        }
                        
                    }else if(this.extension === 2){
                        path = '/zcDrillDetail'
                    }else if(this.extension === 3){
                        path = '/dailyDrillDetail'
                    }else if(this.extension === 4){
                        path = '/fzDrillDetail'
                    }
                    break;
                case 6: // 暂无应急演练页面的跳转
                    path = '';
                    break;
                case 7:
                    path = '/multipleDrillDetail';
                    break;
                case 8:
                    path = '/awdPlusContestDetail';
                    break;
                case 9:
                    path = '/opContestDetail';
                    break;
                case 10:
                    path = '/emergencyDrillDetail';
                    break;
            }
            if (path) {
                let vpn = null
                if ('vpn1211' in extensionObj) {
                    vpn = '1211'
                }else if('vpn1212' in extensionObj){
                    vpn = '1212'
                }
                this.$router.push({
                    path: path,
                    query: {
                        id: data.id, //场景id
                        prjid: data.projectId, //工程id
                        name: data.name,
                        page: this.querySceneInfo.page || this.querySceneInfo.pageIndex,
                        vmInEnable: JSON.parse(data.extension).vmInEnable,
                        path:this.title,
                        vpn,
                        teamIpCount:extensionObj.teamIpCount
                    },
                });
            }
        },
        // 夺旗赛，展示、隐藏激励分具体设置
        changeExtraCredit(val) {
            if (val) {
                this.showExtraCredit = true;
            } else {
                this.showExtraCredit = false;
            }
        },
        // 归档录屏信息
        screenCopyTo(sceneInfo) {
            return new Promise((resolve, reject) => {
                let projectId = sceneInfo.projectId;
                let sceneName = sceneInfo.name.slice(0, 85);
                let params = {
                    projectId,
                    name: sceneName,
                };
                screenCopyTo(params)
                    .then((data) => {
                        if (data.code == 1) {
                            resolve();
                        } else {
                            this.$Message.error(data.message);
                        }
                    })
                    .catch((error) => {
                        this.$Message.error('录屏信息归档异常');
                    });
            });
        },
        // 归档场景信息
        scenefiling(sceneInfo) {
            return new Promise((resolve, reject) => {
                sceneFiling(sceneInfo.id)
                    .then((data) => {
                        if (data.code == 1) {
                            resolve();
                        } else {
                            this.$Message.error(data.message);
                        }
                    })
                    .catch((error) => {
                        this.$Message.error('场景信息归档异常');
                    });
            });
        },
        // 归档操作，提供给子组件调用
        filingAll(sceneInfo) {
            this.scenefiling(sceneInfo).then((data) => {
                    this.getSceneList();
                    this.$Message.info('归档完毕');
                }
            );
            // Promise.all([this.screenCopyTo(sceneInfo), this.scenefiling(sceneInfo)]).then(
            //     (data) => {
            //         this.getSceneList();
            //         this.$Message.info('归档完毕');
            //     }
            // );
        },
        // 查询工程是否存在
        getProjectDetails(id) {
            return new Promise((resolve, reject) => {
                let params = {
                    pageIndex: 1,
                    pageSize: 10,
                    id,
                };
                getProjects(params)
                    .then((data) => {
                        // 存在工程，且工程不处于"工程导入失败"状态，需要再次部署，否则重新构建
                        if (
                            data.code == 1 &&
                            data.data.items.length > 0 &&
                            ![4, 17].includes(data.data.items[0].status)
                        ) {
                            resolve(1);
                        } else {
                            resolve(0);
                        }
                        resolve(1);
                    })
                    .catch((error) => {
                        resolve(0);
                    });
            });
        },
        //查询归档状态
        getFilingStatus(sceneInfo) {
            return new Promise((resolve, reject) => {
                let params = {
                    pageIndex: 1,
                    pageSize: 10,
                    sceneId: sceneInfo.id,
                };
                getFilingList(params)
                    .then((data) => {
                        if (data.code == 1 && data.data.items.length > 0) {
                            resolve(1);
                        } else {
                            resolve(0);
                        }
                    })
                    .catch((error) => {
                        resolve(0);
                    });
            });
        },
        //查询归档进度
        getCopyProgress(project) {
            return new Promise((resolve, reject) => {
                getCopyProgress(project.projectId)
                    .then((data) => {
                        if (data.code == 1) {
                            resolve(data.data.progress || '无进度');
                        } else {
                            resolve('获取进度失败');
                        }
                    })
                    .catch((error) => {
                        resolve('获取进度失败');
                    });
            });
        },
        openSceneTemplateModal(sceneId) {
            this.generateTemplateModal.show = true;
            this.generateTemplateModal.sceneId = sceneId;
        },
        // 打开父组件中的快速构建组件，并传入当前选中的列表数据
        quickCreate(item) {
            if ([1, 2, 8, 9].includes(item.type)) {
                this.$refs.quickCreatModal.openQuickModal({ row: item });
            } else {
                this.$refs.quickCreatDrillModal.show(item);
            }
        },
        // 资产信息列表
        getProductList () {
            let params = {
                pageIndex:1,
                pageSize:2147483647
            }
            queryProductGroupList(params)
                .then(res => {
                    if (res.code == 1) {
                        this.productList = res.data.items
                    }
                })
                .catch(err => {
                    
                })
        },
        getCtfRank(id){
            return new Promise((resolve,reject) => {
                let objctf={
                    pageIndex:1,
                    pageSize:1,
                }
                ctfTeamRankStatis(id,objctf).then(data=>{
                    if(data.code==1){
                        resolve(data.data.items)
                    }else{
                        resolve()
                    }
                }).catch(error => {
                    resolve()
                })
            })
        },
    },
};
</script>

<style scoped>
#projectInfo,
#vulneraStatisticsInfo {
  display: table;
  width: 100%;
  border: 1px solid var(--table-border);
  table-layout: fixed;
  word-break: break-all;
}
#projectInfo p,
#vulneraStatisticsInfo p {
  display: table-row;
  line-height: 36px;
  text-align: center;
}
#projectInfo p span,
#vulneraStatisticsInfo p span {
  display: table-cell;
  border-bottom:1px solid var(--table-border);
}
.score-div {
    display: flex;
}
.score-div > div {
    display: flex;
    margin-left: 10px;
}
.score-div > div:first-child {
    margin-left: 0;
}
.score-div > div > span {
    display: inline-block;
    width: 40px;
}

.levelConfig {
    display: flex;
    margin-bottom: 10px;
    align-items: center;
    margin-left: -30px;
}

.levelConfig /deep/ .ivu-input-group-prepend {
    background-color: rgb(56, 56, 211) !important;
    border-color: rgb(56, 56, 211) !important;
    color: #fff;
}

.levelConfig /deep/ .ivu-form-item {
    margin-bottom: 10px;
}

.levelConfig /deep/ .levelConfig-label {
    float: left;
    text-align: center;
    background-color: rgb(56, 56, 211) !important;
    border-color: rgb(56, 56, 211) !important;
    color: #fff;
    border-radius: 4px 0 0 4px;
}
.levelConfig /deep/ .levelConfig-label-small {
    width: 50px;
}
.levelConfig /deep/ .levelConfig-label-long {
    width: 74px;
}
.levelConfig /deep/ .levelConfig-label + .ivu-input-number {
    border-radius: 0 4px 4px 0;
    margin-top: -2px;
}
.levelConfig /deep/ .ivu-input-group-prepend {
    background-color: rgb(56, 56, 211) !important;
    border-color: rgb(56, 56, 211) !important;
    color: #fff;
}
.levelConfig /deep/ .ivu-form-item {
    margin-bottom: 10px;
}
.form-gourp {
    border: 1px solid var(--card-line-color);
    margin-bottom: 20px;
    position: relative;
    padding: 10px;
}
.form-gourp:last-child {
    margin-bottom: 0;
}
.form-title {
    color: var(--default-color);
    font-weight: bold;
    position: absolute;
    position: absolute;
    top: -9px;
    left: 10px;
    background-color:var(--modal-bgcolor);
    display: inline-block;
    padding: 0 6px;
}
</style>
<style>
.resultInfoModal .ivu-modal .ivu-modal-body .network-operating-record .search-table .header{
    margin-top: 0px !important;
}
.drillsTable .ivu-poptip-body {
    text-align: left !important;
}

.scenesHeader {
    margin: 16px 0;
}

.drillTables {
    min-height: 300px;
}

.drillsTable.ivu-table-wrapper {
    overflow: inherit;
}

.demo-split {
    /* overflow-y: scroll;*/
    height: 280px;
    border: 1px solid #dcdee2;
}

.demo-split-pane {
    padding: 10px;
}

/*.ivu-table-body{
          max-height :calc(100vh - 228px);
          overflow:hidden auto;
      }*/
::-webkit-scrollbar {
    width: 5px; /*滚动条宽度*/
    height: 5px; /*滚动条高度*/
}

/*定义滚动条轨道 内阴影+圆角*/
::-webkit-scrollbar-track {
    border-radius: 2.5px; /*滚动条的背景区域的圆角*/
    background-color: #e6e6e6; /*滚动条的背景颜色*/
}

/*定义滑块 内阴影+圆角*/
::-webkit-scrollbar-thumb {
    border-radius: 2.5px; /*滚动条的圆角*/
    background-color: #aaa; /*滚动条的背景颜色*/
}

.filter-wrap-14p .ivu-input,
.filter-wrap-14p .ivu-checkbox-inner,
.filter-wrap-14p button,
.filter-wrap-14p .ivu-select-selection {
    border-color: #a9a9c8;
    color: #a9a9c8;
}

.filter-wrap-14p .ivu-select-selection {
    border-radius: 20px;
}

.filter-wrap-14p .ivu-input:focus {
    box-shadow: 0 0 0 2px rgba(169, 169, 200, 0.4);
}

.filter-wrap-14p .ivu-checkbox-checked .ivu-checkbox-inner {
    background-color: rgb(56, 56, 211);
}

</style>
